System.out.print("Enter string1: ");
str1 = scan.nextLine();
System.out.print("Enter integer1: ");
int1 = scan.nextInt();
System.out.print("Enter string2: ");
str2 = scan.nextLine();
System.out.println("You entered string1 is= " + str1 + ", integer1: " + int1 + " and string2: " +str2);
And my app results:
Enter string1: A // I entered A
Enter integer1: 5 // I entered 5
Enter string2: You entered string1 is= A, integer1: 5 and string2:
As you see my app don't ask me for entering string2. If I change int and string2 positions so enter string2 before int it works but not work like that. What&where is my mistake?