0

I got this class.

public class LGMenu {

    String User; 
    String Password;

    public void setUser(String User) {
        this.User = User;
    }


    public void setPassWord(String Password) {
        this.Password = Password;
    }

    public boolean menu(String user,String password){

           Boolean flag = false;

           String input = User + Password;

           String input2 = user + password;


            if(input == input2){
                flag = true;
            }
            return flag;
        }

    }

And this class.

public class Trial{

 String id;
 String password;

public Libreta(){

        if(id ==null){
        setId(reader.read());
        setPassword(reader.read());}


    }

private void setId(String id) {
        this.id = id;

    }

private void setPassword(String password) {
    this.password = password;

}

Every time i create a Trial instance im setting the properties id and password permanently for that instance. Im trying to create a sort of like a log in interface by comparing the id and password of the Trial instance within a loop and continuously setting the properties of LGMenu in a different class altogether, like this:

while((n3.menu(user, password)) == false){

                System.out.println("User:");
                User = keyboard.nextLine();
                n3.setUser(User);
                System.out.println("Password:");
                Password = keyboard.nextLine();
                n3.setPassWord(Password);       

        }

But why isnt it working?

0 Answers0