I have the following code:
public class String verifyWord(String wordChosen, Scanner reader){ //linha 1
boolean answeredCorrectly = false;
int tries = 1;
String wordChosen = random.nextInt();
String answer = wordChosen;
while(tries>0 && answeredCorrectly == false) { //linha 6
answer = reader.nextInt();
if(wordChosen == answeredCorrectly) {
System.out.println("You got it right");
answeredCorrectly=true;
}
else if(answered =! wordChosen){
System.out.println("Wrong");
}
}
}
In the first line according to the program there is an error, after String
says that I must for a {
key, but I believe this is not the solution. In line 6 in while
the program says:
"illegal start of type". ~
I started very little time and I do not understand how to solve these errors.