Bom dia galera do GUJ!!!
Alguem poderia me auxiliar a resolver
esse erro de compilação que ocorre nesse codigo??!
public class SimpleDotCom
{
public static void main (String[] args){
int numOfGuesses = 0;
GameHelper helper = new GameHelper();
SimpleDotCom theDotCom = new SimpleDotCom();
int randomNum = (int) (Math.random() * 5);
int[] locations = {randomNum, randomNum+1, randomNum+2};
theDotCom.setLocationCells (locations);
boolean isAlive = true;
while (isAlive == true) {
String guess = helper.getUserInput ("Insira um número");
String result = theDotCom.checkYourself(guess);
numOfGuesses++;
if (result.equals("Kill")) {
isAlive = false;
System.out.println ("Você usou " + numOfGuesses + " palpites");
}
}
}
}
O Compilador retorna um erro cannot find symbol
no array locations quando eu passo por referencia
na linha 10.
No mesmo pacote ainda existe uma outra classe
import java.io.*;
public class GameHelper
{
public String getUserInput (String prompt) {
String inputLine = null;
System.out.print(prompt + " ");
try {
BufferedReader is = new BufferedReader (new InputStreamReader (System.in));
inputLine = is.readLine();
if (inputLine.length() == 0) return null;
}
catch (IOException e) {
System.out.println("IOException: " + e);
}
return inputLine;
}
}
Talvez possa ajudar na resolução do problema!
Obrigado!!!
