josh said:
If I have a method in my subclass returning a String and I
make>>>>> return super
why does not the compiler call toString() method ?
is it not equal to keyword "this"?
This would be clearer if you included a tiny example that showed what you want
to do. But the answer is twofold:
1) super is not a reference to a type, it's a way to un-override uses of
methods and members. this.foo() and super.foo() both call foo() on the
"this" object, but super.foo() runs the code in the superclass rather than
in this class. You can't return super in the same way you can return this,
because there is no distinct super object, it's effectively just part of this.
2) You can't return an object (not even "this") from a method that returns
String anyway. You can only return a String. You can return this.toString(),
or you can return super.toString().