我的第一个JOptionPane程序有点问题。我没有得到我的if语句输出任何东西。我做错了什么?
package test1;
import javax.swing.JOptionPane;
public class Lol1 {
public void test() {
String res;
res = JOptionPane.showInputDialog("Does this work?");
if (res == "Yes") {
JOptionPane.showMessageDialog(null, "Good.");
}
if (res == "No") {
JOptionPane.showMessageDialog(null, "You're lying.");
}
}
public static void main(String[] args) {
Lol1 l1 = new Lol1();
l1.test();
}
}