toString() is a method in a lot of classes. For what class are you trying to call its toString() method?
You call the toString()method like any other method:
String aStr = refToClass.toString();
Type: Posts; User: Norm
toString() is a method in a lot of classes. For what class are you trying to call its toString() method?
You call the toString()method like any other method:
String aStr = refToClass.toString();
Do you understand what the scope of definition for a variable is? You can not use a variable if it is not defined or if the definition for the variable is out of scope (not inside of the enclosing...
Yes, faceName is defined inside of the toString() method. Do you get an error with the code in post#7?
Where is the variable faceName defined? You can not use a variable whose definition is not in scope at that location.
Use the return statement with the String you want to have returned by the method. Look at the toString() method in the Coin class. It returns the String: faceName.