Hello here's my code
I want user to enter the word "Yes" instead of 1, How do I achieve this?
import java.util.Scanner;
public class Quest {
public static void main(String[] args){
Scanner ui = new Scanner(System.in);
int a=1,b=2;
System.out.println("You have come across a troll! Do you kill it? Press 1 to fight the troll");
a=ui.nextInt();
if(a==1){
System.out.println("You have killed it!");
}
else
System.out.println("you lost");
}
}
I want user to enter the word "Yes" instead of 1, How do I achieve this?