Results 1 to 3 of 3

Thread: Error with Java Classes

  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Error with Java Classes

    Hi there, I'm a newbie in Java and I'm having problems when I try to compile this program. I don't now What I'm doind wrong here. Is saying that there is a error on line 39.

    import java.util.*;
    import java.util.ArrayList;
    public class Player {

    public Player (){

    Die dice; // A variable that will refer to the dice.
    int rollCount = 0; // Number of times the dice have been rolled.

    dice = new Die(); // Create the dice object.


    ArrayList<Integer> list = new ArrayList<Integer>();

    int i=0;

    do {
    dice.roll();
    i = dice.getDie();
    System.out.println("Number Rolled " +i);
    rollCount++;

    if (!list.contains(i)) /*list numbers given by Die*/

    list.add(i);

    System.out.println("So far, you have" + list);/*Shows on the screen the result*/
    }
    while (list.size() < 6);
    }

    public int getrollCount(){
    return rollCount;

    }

    } // end class


    Anyone can give a hand here to fix this error.

    Thank you in advance.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Error with Java Classes

    Hello, I am not getting anything from your code. If you provide me error which you are getting then it may possible that I can solve your problem. So, please provide me error message which you are getting while compiling your program. I have check all the code, but unable to find error, but if you provide error, it can helpful to fix the error.

  3. #3
    Join Date
    Feb 2010
    Posts
    2

    Re: Error with Java Classes

    Player.java:39: cannot find symbol
    symbol : variable rollCount
    location: class Player
    return rollCount;
    ^
    1 error

    ----jGRASP wedge2: exit code for process is 1.
    ----jGRASP: operation complete.

Similar Threads

  1. get classes and object in java
    By preeti makkar in forum Software Development
    Replies: 1
    Last Post: 07-05-2012, 11:08 AM
  2. JavaScript Error Components.classes
    By Bricklayer in forum Software Development
    Replies: 3
    Last Post: 18-08-2010, 04:01 PM
  3. Automatic generation of classes UML.java
    By TechGate in forum Software Development
    Replies: 5
    Last Post: 04-03-2010, 11:10 AM
  4. Query in java classes
    By Aaliya Seth in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 01:34 AM
  5. What are the different collection classes of java
    By Sacchidananda in forum Software Development
    Replies: 3
    Last Post: 24-11-2009, 03:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,572,974.86997 seconds with 17 queries