class Gen {
T ob;
Gen(T o) {
ob = o;
}
T getObject() {
System.out.println("Gen's getObject(): " );
return ob;
}
}
class Gen2 extends Gen {
Gen2(T o) {
super(o);
}
T getObject() {
System.out.println("Gen2's getObject(): ");
return ob;
}
}
public class MainClass{
public static void main(String[] arg){
Gen intObject = new Gen(88);
Gen2 longObject = new Gen2(99L);
intObject.getObject();
longObject.getObject();
}
}
Gen's getObject():
Gen2's getObject():