I want to add a toString
method in the Item
class that returns the title of the item in there.
I have need make sure that the toString met
Item toString
:
public String toString()
{
return title;
}
DVD toString
:
public String toString()
{
return super.toString() + " director: " + director;
}
Also, I don't know what you're trying to do with this but I would put those print()
methods in these classes.
You will be better of returning the string representation and printing it somewhere else (with this you can test this class without mocking System.out
)
Cheers