What I am trying to do is test the values of two variables, and if one is lower than the other then it will display an error message. When the user clicks okay it should return from the error pop-up back to the previous form... When I enter System.exit(0); or break;. it will terminate the program, is there a better syntax ?
My code:
//Declare and initialize variables
int income = 0;
int houseCost = 0;
//Assigns data from text field to variables
Income = Integer.parseInt(txtIncome.getText());
houseCost = Integer.parseInt(txtHouseCost.getText());
//Is income less than house cost ?
if (income < houseCost)
{
JOptionPane.showMessageDialog(null, "Your income is less than your housing cost.", "Error", JOptionPane.ERROR_MESSAGE);
}