public class ControlFlow {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Are you hungry?\n");
String answer = input.nextLine();
input.close();
if(answer == "yes") {
System.out.println("Food is on the table!");
}else {
System.out.println("Not hungry!\n");
}
}
}
I tried with boolean variable too. It did not help