The code below is what im putting into Notepad++ and when i try to run it in command prompt with
java it tells me that i have 6 errors with result, do i need to make a method for result or does it already know what result is supposed to do?
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);
for (int cell : locationCells) {
if (guess == cell) {
result = "hit";
numOfHits++;
break;
}
}
if (numOfHits == locationCells.length) {
result = "kill";
}
System.out.println(result);
return result;
}
}