I'm write everything according to my book Head First Java
public class SimpleDotComTestDrive{ public static void main(String[] rip ){ SimpleDotCom dot = new SimpleDotCom(); int[] locations ={2,3,4}; dot.setLocationCells(locations); String userGuess ="2"; String result = dot.checkYourself(userGuess); } } public class SimpleDotCom{ int[] locationCells; int numOfHits=0; public void setLocationCells(int[] locs){ locationCells=locs; } public String checkYourself(String stringGuess){ int guess= Integer.parseInt(stringGuess); String result="miss"; for(int cell : locationCells){ if(guess== cell){ result = "hit"; numOfHits++; break; } } if(numOfHits == locationCells.length){result="Kill";} System.out.println(result); return result; } } This is the Error
class SimpleDotCom is public, should be declared in a file named SimpleDotCom.java AND if i tried to save my file on the SimpleDotCom class i still got error like ename expected(brackets).
