Hey guys im really new to java, trying to learn it a bit by myself I appreciate help with this!
This is my code:
Im getting an error when trying to run it (With Netbeans IDE)
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - variable number is already defined in method main(java.lang.String[]) at Comparison.main(Comparison.java:10) Java Result: 1
import java.util.Scanner; public class Comparison { public static void main( String[] args ) { Scanner input = new Scanner( System.in ); int number 1; int number 2; System.out.print( "Enter First Integer: " ); number1 = input.nextInt(); System.out.print( "Enter First Integer: " ); number1 = input.nextInt(); if ( number1 == number2 ) System.out.printf( "%d == %d\n", number1, number2 ); if ( number1 != number2 ) System.out.printf( "%d != %d\n", number1, number2 ); if ( number1 < number2 ) System.out.printf( "%d < %d\n", number1, number2 ); if ( number1 > number2 ) System.out.printf( "%d > %d\n", number1, number2 ); if ( number1 <= number2 ) System.out.printf( "%d <= %d\n", number1, number2 ); if ( number1 >= number2 ) System.out.printf( "%d >= %d\n", number1, number2 ); } }