The problem is, every time we type “no”, we have to type it twice??
We don’t understand why? Please help…
package dandd.aanda;
import java.util.Scanner;
public class TestPrintf {
public static void main(String[] args) {
String yes = "yes";
String no = "no";
System.out.println("type yes or no");
Scanner input = new Scanner(System.in);
if (input.nextLine().equals(yes)) {
System.out.println("Follow me then boooyyyoo!!!!");
} else if (input.nextLine().equals(no)) {
System.out.println("Alright then laddy, you just going to sit on the porch all day and crrry then?");
} else {
System.out.println("that didn't help me, yes or no?");
}
}