A nongeneric class can be the superclass of
a generic subclass.
class NonGen {
int num;
NonGen(int i) {
num = i;
}
int getNumber() {
return num;
}
}
class Gen extends NonGen {
T ob;
Gen(T o, int i) {
super(i);
ob = o;
}
T getObject() {
return ob;
}
}
public class MainClass {
public static void main(String args[]) {
Gen w = new Gen("Hello", 47);
System.out.print(w.getObject() + " ");
System.out.println(w.getNumber());
}
}
Hello 47