import javax.swing.JOptionPane;
public class New {
public static void main (String[] args) {
String name = JOptionPane.showInputDialog("Enter your name... ");
JOptionPane.showMessageDialog(null, "Hi, "+name);
int age = Integer.parseInt(JOptionPane.showInputDialog("Enter your age... "));
if(age>=18) { JOptionPane.showMessageDialog(null, "Welcome!");}
else { JOptionPane.showMessageDialog(null, "You are not an adult!");
System.exit(0);}
String day = JOptionPane.showInputDialog("What's the day? ");
if(day == "Monday") { JOptionPane.showMessageDialog(null, "Welcome back to school!");}
else {JOptionPane.showMessageDialog(null, "Come back later!");}
}
}
It always gives a "Come back later" message and totally ignoring the "if" -I'm a very beginner, this code is from a tutorial on youtube, tried to edit and I faced this problem-