Java - Super.toString() method in base class?
问题 My question is what is the reason to write Super.toString() in base class and what it returns and why ? this is my code : class Person { public String toString() { return super.toString() /*+ "->" + "Person" + name + "------"*/; } } what is supposed to be return ? and thanks i m beginner in java 回答1: Your class Person should extend parent class where you define method toString(), otherwise your parent class is class Object and the native method of this class is going to be used: public String