import java.util.Scanner;
import java.util.Random;
public class cominback{
public static void main(String args[]){
Scanner key = new Scanner(System.in);
System.out.println(" please enter a password:");
String x = key.nextLine();
System.out.println("Connfirm your password:");
String y = key.nextLine();
if ( x == null)
System.out.println("please restart the program:");
if (x != y)
System.out.println("wrong password");
if (x == y )
System.out.println("you are logged in");
}
}
It always print out wrong password for even when the input is same passwords. how can i fix this problem? did i do something wrong or is it my eclipse glitching?