I am a first year studying app development and I have a login and registration assignment.
But Im struggling to make a method where it checks if the username and password registered matches the entered login details?
I am mostly using System.out.println
Here is the Login.java
package st10035771;
import java.util.Scanner;
public class Login {
    public final static int USERNAME_LIMIT = 5;
    public final static int PASSWORD_LENGTH = 8;
    private static String userName;
    private static String userPass;
    private static String message;
    private static String firstName;
    private static String lastName;
    public static Scanner un = new Scanner(System.in);
    public static boolean checkUserName(String userName) {
        if (userName.length() <= USERNAME_LIMIT && userName.contains("_")) {
            return true;
        } else {
            return false;
        }
    }
    /*
     * code attribute
     * this code was adapted from DelftStack
     * https://www.delftstack.com/howto/java/password-checker-java/
     */
    public static boolean checkPasswordComplexity(String userPass) {
        boolean isValidPassword = false;
        final int minUppers = 1;
        final int minDigits = 1;
        final int minSpecials = 1;
        int uppers = 0;
        int digits = 0;
        int specials = 0;
        for (int i = 0; i < userPass.length(); i++) {
            char ch = userPass.charAt(i);
            if (Character.isUpperCase(ch))
                uppers++;
            else if (Character.isDigit(ch))
                digits++;
            // if (ch >= 33 && ch <= 47 || ch == 64) {
            if (!Character.isLetterOrDigit(ch)) {
                specials++;
            }
        }
        if (userPass.length() >= PASSWORD_LENGTH && uppers >= minUppers && digits >= minDigits
                && specials >= minSpecials) {
            return isValidPassword = true;
        }
        return isValidPassword;
    }
    public static void inputUser() {
        System.out.println("Please enter username:");
        setUserName(un.next());
        if (checkUserName(userName)) {
            System.out.println("Username successfully captured");
        } else {
            System.out.println(
                    "Username is not correctly formatted, please ensure that your username contains an underscore and is no more than 5 characters in length.");
        }
    }
    public static void inputFName() {
        System.out.println("Please enter your name:");
        setFirstName(un.next());
        System.out.println("Please enter your surname:");
        setLastName(un.next());
    }
    public static void inputPass() {
        System.out.println("Please enter password:");
        setUserPass(un.next());
        if (checkPasswordComplexity(userPass)) {
            System.out.println("Password successfully captured");
        } else {
            System.out.println(
                    "Password is not correctly formatted, please ensure that the password contains at least 8 characters, a capital letter, a number and a special character.");
        }
    }
    public static String registerUser() {
if((checkUserName(userName)) == false){
        return "Username is not correctly formatted, please ensure that your username contains an underscore and is no more than 5 characters in length.";
    }
if((checkPasswordComplexity(userPass)) == false){
        return "Password is not correctly formatted, please ensure that the password contains at least 8 characters, a capital letter, a number and a special character";
    }
return "Welcome " +firstName+" "+lastName+",it is great to see you.";
        
    }
    
    public boolean loginUser(){
        if ((registerUser())  ==  )
        
    }
    /**
     * @param aUserPass the userPass to set
     */
    public static void setUserPass(String aUserPass) {
        userPass = aUserPass;
    }
    /**
     * @param aMessage the message to set
     */
    public static void setMessage(String aMessage) {
        message = aMessage;
    }
    /**
     * @param aFirstName the firstName to set
     */
    public static void setFirstName(String aFirstName) {
        firstName = aFirstName;
    }
    /**
     * @param aLastName the lastName to set
     */
    public static void setLastName(String aLastName) {
        lastName = aLastName;
    }
    /**
     * @param aUserName the userName to set
     */
    public static void setUserName(String aUserName) {
        userName = aUserName;
    }
}
The method in question is loginUser()
 
     
    