Originally Posted by
Psychotron
When I do the code below I can't get reach it outside the method. "System.out.println(s);" doesn't work. How do I get it to work outside the method:
public String toString()
{
String s = "";
s = s + "ID: " + name;
s = s + "ID: " + grade;
return s;
}
Could you include the code you're using to call the toString() method in context? And clarify what you mean by "doesn't work" (is there an compile error? If so, please post it). The more detail you provide will not only help us help you solve the problem, but may even help you solve the problem yourself.