You should be able to just re-write the toString()
method in your derived class if this is what you are aiming for. If you do, don't forget the @Override
annotation.
Java super a toString method [closed]
-
10-10-2022 - |
Domanda
In a super abstract class I have a toString
method and I want to inheritance it. How to do that?For example
A a = new A(1,name);
A extends my superclass
and I want to the output to be "A with 1,name"
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow