So I'm trying to make a simple program, for the first JOptionPane Input its asking for the username, then I made an If statement that will print the word "admin" if the String that is attached to the username Input is "admin" However, It's not working and the else statement is executing every time. What am I doing wrong?
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Shipping {
public static void main(String args[]) {
String user;
user = JOptionPane.showInputDialog ("Please enter your username ");
String pass;
pass = JOptionPane.showInputDialog ("Please enter your password ");
if (user == "admin")
System.out.println ("admin");
else
System.out.println("test");
}
}