You can subclass Java classes like Python classes. Here's an example of subclassing the Java class java.util.Date (from MyDate.py):
from java.util import Date class MyDate(Date): def __init__(self, num=None): if num is None: Date.__init__(self) else: Date.__init__(self, num) def __str__(self): str = Date.toString(self) str = "MyDate: " + str return str
When you subclass a Java class, you call its superclass's constructor, just as you do in regular Python. As we saw, the MyDate.py example subclassed the Date class from java.lang and defined two constructors that called Date's base class constructors.
As an exercise, look up the constructors of java.lang.Date in the Java API documentation. ...