... a Scanner that inputs data from the standard input (i.e., the keyboard).

Lines 12–13

System.out.print("Enter first integer:"); // prompt
int number1 = input.nextInt(); // read first number from user

prompt the user to enter the first integer and input the value, respectively. The value is stored in the int variable number1.

Lines 15–16

System.out.print("Enter second integer:"); // prompt
int number2 = input.nextInt(); // read second number from user

prompt the user to enter the second integer and input the value, respectively. The value is stored in the int variable number2.

Lines 18–20

if (number1 == number2) {
System.out.printf("%d == %d%n", number1, number2);
}

compare the values of variables number1 and number2 to test for equality. If

Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.