I am using try/catch for an incorrect input for a dialog box that only accepts integers. I was told by my TA that I need to import something. I tried this but still get the same error on line 8:
import java.lang.NullPointerException; //put this where it should be
try
{
buttons.rotatebutton(); //method I created
}
catch (NumberFormatException | NullPointerException e)
{
System.out.println("Please type a number");
if (e == NullPointerException) //ERROR OCCURS HERE
{
System.out.println("User cancelled");
}
}
Can anyone shed some light?