Public void print () {
System. The out. Println (" method ");
}
Public static void main (String [] args) {
ERTU FTY effects=new NJI ();
FTY effects. The print ();
NJI tuy=(NJI FTY effects ());
Tuy. Print ();
Tuy. ChildMethod ();
}
}
The class NJI extends ERTU {
Public void childMethod () {
System. The out. Println (" only defined in subclasses method ");
}
}
Why NJI tuy=(NJI FTY effects ()); Downcast complains only this one place, for NJI tuy=(NJI) NJI (); This is no problem, why?
CodePudding user response:
FTY effects is an object that is not a class typeCodePudding user response: