Than how can I reference the toString?
Type: Posts; User: iDizzle
Than how can I reference the toString?
Nope. No errors in the class itself or the toString method. I only get an error when I try to use System.out.println(faceName); or System.out.println(face); or however else I try to call the toString.
public String toString()
{
String faceName;
if (face == HEADS)
faceName = "Heads";
else
faceName = "Tails";
return faceName;
}
}
Thanks for chiming in Norm. When I try "System.out.println(faceName);" the compiler still says that "faceName cannot be resolved to a variable".
So based on the first code above(the Coin class), would I do something like "System.out.println(faceName);" ? Or how would I get the program to return the value in the toString method in the Coin...
Hi everyone. I'm writing a program that is using a class called Coin.java, that flips a coin. The program is supposed to find the longest run of Heads in 100 flips of the coin. I'm having trouble...