Hi all. Me again. I hope everyone is doing OK. I have a simple enough little program here, that according to my n00b mind, should be working just fine. 'Cept I keep getting this error message: "java:21: error: variable hasInsurance might not have been initialized" and I don't really know why. If anyone cares to chime in, I'd be grateful.
import javax.swing.JOptionPane; public class MyMedicalProgram2 { public static void main(String[] args) { String isPatient; String hasInsurance; String isCurrent; isPatient = JOptionPane.showInputDialog("Are you a current patient? Enter Yes or No."); if (isPatient != "Yes") { JOptionPane.showMessageDialog(null, "Please fill out our new-patient forms. All of them."); } else { hasInsurance = JOptionPane.showInputDialog("Do you have insurance? Enter Yes or No"); } if (hasInsurance != "Yes") { JOptionPane.showMessageDialog(null, "Well then we're going to need the money up front."); } else { isCurrent = JOptionPane.showInputDialog("Is your information current? Enter Yes or No."); } if (isCurrent != "Yes") { JOptionPane.showMessageDialog(null, "Please fill out these forms. All of them."); } else { JOptionPane.showMessageDialog(null, "Please have a seat and we will be with you in our own good time."); } } }