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? 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);}}

Is the subclass variable? You have not declared, therefore this.Type refers to the variable in the Superclass.

If you have 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.

In addition, this Spoil the kind of erase, because it easily gets confused type what do you mean.

Comments

  1. शौकिया कोडर्स के लिए जावा प्रोग्रामिंग कोड स्निपेट
    क्लास स्टैक जावा कोड

    ReplyDelete

Post a Comment

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -