I am trying to learn Java and want it so you input your name, and if name input matches your name it will print Hello [your name], I am doing this using an if statement and make if so if the input is equal to a string equal to my name it will print hello plus the input. However it doesn't... the else statement is what confuses me because I got it to print the two value to see if they where equal and they both where... help would be appreciated thanks.
package AgeTester;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class HelpSystem {
public static void main(String args[]) {
String inp = "Jono";
JFrame frame = new JFrame("Input Dialogue");
String name = JOptionPane.showInputDialog(frame, "What is your name?");
if (inp == name) {
System.out.printf("Hello", name);
} else {
System.out.println(inp + name);
}
System.exit(0);
}
}