I have been trying to figure this out for hours, but I am unable find an answer that works.
For completeness, I have posted the entire code below. If I do not Override
Since you have provide parameter to your toString()
method, it is no more the Object
's class toString()
method. It is a new method and works as a overloaded version of Object
's toString()
not the overridden version. Remove the parameter. To work the toString()
properly you need to have the exactly same method signature -
public String toString(){
//implmentation
}