Home > Back-end >  Excuse me down type conversion problem
Excuse me down type conversion problem

Time:04-13

Public class ERTU {
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 type

CodePudding user response:

reference 1st floor KeepSayingNo response:
FTY effects is an object that is not a class type o

Thank you for your help

CodePudding user response:

refer to the second floor hurricane 飗 response:
Quote: refer to 1st floor KeepSayingNo response:
FTY effects is an object that is not a class type o

Thank you for your help

I know, that only with a class is not behind,
  • Related