So i am new to programming and I have been trying to make a simple program for practice.
It asks you questions and you answer it.
I can't seem to get it to work right. It either Says its correct when it's not or that it isn't correct when it is.
Here is my code
// Questions
String q1;
JOptionPane.showInputDialog(null, "1). What is the name of our sun?");
if(q1 == "Sol") {
JOptionPane.showMessageDialog(null, "Correct!");
}
else {
JOptionPane.showInputDialog(null, "Sorry that is incorrect :(");
}
What am I missing?