Code:
public class validateLogin{
 
   
    public boolean validate(String username, String password) {
        
        boolean state = false; 
       
       
               if(username.equals(user) && password.equals(pass))
              {                  
                  state = true;
              }
              else
                  state =false;         
            }           
            
        
        }
        return state;    
        
        
    }
Then I create a page where the username and the password are going through and the above class is just validate. If the state is true the user will be redirected to another page; however, I don't know how to call the state attribute and put it in an if statements. I create an object and call the validate method know I want to create and if statement .
ValidateLogin v = new ValidateLogin();
v.validate(username, password);
if(state = true) //HOW DO I CALL THIS ATTRIBUTE THAT IS IN ANOTHER CLASS?
redirect to page