I'm new to programming java so i'm not sure if this is the easiest way to do things and have spent a few hours trying to figure this out with no luck.
The
System.out.println("Respond (Yes) or (No) ...");
part of the program doesn't initially respond to an empty user input and displays the above text twice. After the 1st incorrect entry it behaves as it should??
`package qaCoursework;
import java.util.Scanner;
public class Test2 {
public static void main(String[] args) {
Scanner Input = new Scanner(System.in);
System.out.println("Enter Name...");
String name = Input.nextLine();
System.out.println("Enter age...");
int age = Input.nextInt();
System.out.println("Do you like programming ...?");
while (true) {
String Response = Input.nextLine();
if (Response.equalsIgnoreCase("yes")) {
System.out.println(name + " is " + age + " and loves programming");
break;
}
else if (Response.equalsIgnoreCase("no")) {
System.out.println(name + " is " + age + " and hates computers ...!");
break;
}
else {
System.out.println("Respond (Yes) or (No) ...");
}
}
}
}`