June 2017
Beginner
1296 pages
69h 23m
English
... a Scanner that inputs data from the standard input (i.e., the keyboard).
Lines 12–13
System.out.print("Enter first integer:"); // promptint 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:"); // promptint 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
Read now
Unlock full access