I am new to Java, and trying out simple examples to get familiar with the basics. This is a program to see if three integers specified by the user are all equal.
import java.lang.*;
import java.util.*;
public class CheckEqual{
public static void main(String [] args){
if (args.length != 5){
System.out.println("Please check the number of your integers!");
return;
}
try{
int firstInteger = Integer.parseInt(args[2]);
int secondInteger = Integer.parseInt(args[3]);
int thirdInteger = Integer.parseInt(args[4]);
}
catch(NumberFormatException e){
System.out.println("Make sure that all inputs are integers!");
return;
}
if (firstInteger == secondInteger && secondInteger == thirdInteger){
System.out.println("True");
return;
}
else{
System.out.println("False");
return;
}
}
}
During compilation, it gave me the error "cannot find symbols" on firstInteger,secondInteger, and thirdInteger. Why is this, and how can I solve it?