Dears, Could you please help me to solve these lines?
import java.util.Scanner;
public class InputOutput {
public static void main(String[] ar) {
Scanner inp = new Scanner(System.in);
System.out.println("Enter User Name");
String UserName=inp.nextLine();
if (UserName=="Ramsid") {
System.out.println("This is Admin User");
}
else if(UserName=="nv"){
System.out.println("This is Operator User");
}
else if (UserName=="abc") {
System.out.println("This is Super User");
}
else {
System.out.println("User Not Exist");
}
}
I am getting always "User Not Exist"
Aucun commentaire:
Enregistrer un commentaire