java - "cannot find symbol " error in oop pig game -
i doing oop pig game. in encounter error: "cannot find symbol class name"
. can please me finding it.
public class player { protected string name; scorekeeper sk; // sk = new scorekeeper(); public player(string name) { this.name = name; //scorekeeper sk = new scorekeeper(); sk = new scorekeeper(); } public player(){ } public int getscore() { return sk.getgametotal; } public string getname() { return name; } public int incscore(int rollvalue) { sk.addtoroundtotal(rollvalue); return sk.getroundtotal; } public int setscore() { return sk.resetroundtable(); } }
this class create object class scorekeeper
, other class is
public class scorekeeper { int gametotal = 0; int roundtotal = 0; public scorekeeper() { //gametotal = 0; //roundtotal = 0; } public void addtogametotal() { gametotal += roundtotal; resetroundtotal(); } public void addtoroundtotal(int value) { roundtotal += value; } public void resetroundtotal() { roundtotal = 0; } public int getroundtotal() { return roundtotal; } public int getgametotal() { return gametotal; } }
when try compiling class
player.java:5: cannot find symbol symbol : class scorekeeper location: class player scorekeeper sk; ^ 1 error
in player-class wrote:
scorekeeper sk;
the "k" needs upper case this:
scorekeeper sk;
java case-sensitive language
Comments
Post a Comment