java - Why does super not refer to the variable in super class? -
In the code below, why is super still reference of subclass variable, and not super class variables? Is the subclass variable? You have not declared, therefore If you have In addition, this Spoil the kind of erase, because it easily gets confused Class Fellin {public string type = "F"; Public fault () {System.out.print ("cat"); }} Public class spreads to cougar felin (public cougar) (system.out.print ("cougar");} public static zero chief (string [] args) {new cougar (.) Go ();} zero go ( ) {Type = "c"; System.out.print (this.type + super.Type);}}
this.Type refers to the variable in the Superclass.
public String Type is declared; both superclass and subclass, as it is We are expecting you to do the work. But now, only one
type variable that you have declared is on the superclass.
type what do you mean.
शौकिया कोडर्स के लिए जावा प्रोग्रामिंग कोड स्निपेट
ReplyDeleteक्लास स्टैक जावा कोड