0
What's wrong with my code
import java.util.Scanner; public class Comparison { public static void main(String[] args) { int number1; int number2; Scanner input = new Scanner(System.in); System.out.print("Enter first integer: "); // prompt number1 = input.nextInt(); // read first number from user System.out.print("Enter second integer: "); // prompt number2 = input.nextInt(); // read second number from user if (number1 == number2) System.out.printf("%d == %d%n", number1, number2); } }
5 Answers
+ 3
It seems to work for me but only give output if the two entered numbers are equal.
0
Yup works fine. What issue are you experiencing?
0
I know that is what it is meant for
0
it says a throw exception error
0
If your getting it in the playground, be sure you are entering all your inputs, each on a separate line, when the input modal comes up. Otherwise, it won't work correctly.