I enter:
- Joe Smith (press enter)
- IT engineer (press enter)
- Y (press enter)
What happens then, is that the loop occurs again but you cant enter your first and last name
a second time.
String name = s.nextLine();
Always seems to be an empty line after the loop executes once.
Why is that?
Code:
Scanner s = new Scanner(System.in);
do {
System.out.printl('Enter your first and last name:');
String name = s.nextLine();
System.out.printl('Enter your job description:');
String job = s.nextLine();
System.out.println("Press Y for loop ..");
char answer = s.next().charAt(0);
} while(answer == 'Y');