I'm trying to make it so you type in you username, then you type it in later
and if the two match then it prints logged in succesfully, but it's basically saying the two don't match..?
import java.util.Scanner;
class Der{
public static void main(String[]arguments)
{
Scanner key = new Scanner(System.in);
System.out.println("Set your Username: ");
String UserName = key.nextLine();
Scanner key2 = new Scanner(System.in);
System.out.println("Enter your UserName");
String EnteredUserName = key2.nextLine();
if (EnteredUserName == UserName)
{
System.out.print("Logged in Successfully");
}
}
}