I am trying to create an if else statement that checks multiple values, one after another, to see whether they are null or not.
The if else statement that I created worked perfectly earlier, but after restarting my pc it no longer works.
Any help is appreciated.
Here is my code:
//Declare Strings
String ProjectNo, Location, VP;
//Store values from text boxes into strings
ProjectNo = txtProjectNum.getText();
Location = txtLocation.getText();
VP = txtVPNo.getText();
if(ProjectNo == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else if (Location == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else if (VP == null){
JOptionPane.showMessageDialog(null, "No fields can be left empty!");
}
else{
JOptionPane.showMessageDialog(null, "All fields have been filled in!");
}
Aucun commentaire:
Enregistrer un commentaire