Search:

Type: Posts; User: iDizzle

Search: Search took 0.10 seconds.

  1. Replies
    12
    Views
    1,995

    [SOLVED] Re: Question about using the toString method.

    Than how can I reference the toString?
  2. Replies
    12
    Views
    1,995

    [SOLVED] Re: Question about using the toString method.

    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.
  3. Replies
    12
    Views
    1,995

    [SOLVED] Re: Question about using the toString method.

    public String toString()
    {
    String faceName;
    if (face == HEADS)
    faceName = "Heads";
    else
    faceName = "Tails";
    return faceName;
    }
    }
  4. Replies
    12
    Views
    1,995

    [SOLVED] Re: Question about using the toString method.

    Thanks for chiming in Norm. When I try "System.out.println(faceName);" the compiler still says that "faceName cannot be resolved to a variable".
  5. Replies
    12
    Views
    1,995

    [SOLVED] Re: Question about using the toString method.

    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...
  6. Replies
    12
    Views
    1,995

    [SOLVED] Question about using the toString method.

    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...
Results 1 to 6 of 6