Possible Duplicate:
Java String.equals versus ==
I'm trying to make a simple user/password system in Java. My code is:
Scanner sc = new Scanner (System.in);
System.out.println("Enter Username :");
String username = sc.nextLine();
System.out.println("Enter Password :");
String password = sc.nextLine();
if (username == "a" && password == "b"){
System.out.print("ok");
}
Or
if (username == 'a' && password == 'b')
I want to make a simple login with user a and pass b but it doesn't work.