I'm having an infinite while loop issue, no matter what I type in even if it is "Filed" or "Incomplete" the loop keeps re prompting and I can't figure out why.
strMajorSheet = JOptionPane.showInputDialog(null,"What is the advisee's major sheet status? (Filed/Incomplete)",
"Advisee's Major Sheet",3);
if(strMajorSheet == "Filed" || strMajorSheet == "Incomplete")
{
switch(strMajorSheet)
{
case "Filed":
blnMajorSheet = true;
case "Incomplete":
blnMajorSheet = false;
}
}
else
{
while(strMajorSheet != "Filed" && strMajorSheet != "Incomplete")
{
strMajorSheet = JOptionPane.showInputDialog(null,"What is the advisee's major sheet status? (Filed/Incomplete)",
"Advisee's Major Sheet",3);
}
please don't compare String using ==
change it to
if(strMajorSheet.equals("Filed") || strMajorSheet.equals("Incomplete"))
......
while(!strMajorSheet.equals("Filed") && !strMajorSheet.equals("Incomplete"))
......