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"

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top