public void comparelast(String lastnamestr) { boolean x = false; x = lastnamestr.equalsIgnoreCase(origlastnamestr); if (x) { String diffstr = ("they are diff"); JOptionPane.showMessageDialog(null,diffstr,"The last names are diff", JOptionPane.INFORMATION_MESSAGE); } else { String samestr = ("they are the same"); JOptionPane.showMessageDialog(null,samestr,"The last names are the same", JOptionPane.INFORMATION_MESSAGE); } }