2021年3月28日星期日

How can I access the superclass toString method?

public class override {        public static void main(String[] args) {          c1 obj = new c1();          System.out.println(obj);      }  }    class a1 {      public String toString (){          return "this is clas a";      }  }    class b1 extends a1{      public String toString (){          return "this is clas b";      }  }    class c1 extends b1{      public String toString (){          return super.toString() + "\nthis is clas c";      }        }  

I need to access the superclass a1 toString method in c1 subclass. Is there any way to do it. I'm learning java, any help would be a great support.

https://stackoverflow.com/questions/66847877/how-can-i-access-the-superclass-tostring-method March 29, 2021 at 09:57AM

没有评论:

发表评论