Here is an example solution:
public String toString()
{
return ("This is a room identifier object for " + blockName +
" " + roomNumber + ".");
}
You could also build up a string in the following manner:
public String toString()
{
String result;
result = "This is a room identifier object for " + blockName;
result = result + " " + roomNumber + ".";
return result;
}
You may find it easier to read the longer version of this method.
The correct behaviour of a toString method depends on how we intend to use it. In this case we did not specify carefully what it should return, so variations on the above are perfectly acceptable.