How to Run private class method.in same class in java : Can figure why it won't allow me to run the displaymainMethod because its private even though i know i can run it from from same class. is there a way to do this without using reflective API.


    import java.util.*;

    public class LoginPrototype {

    public static void main(String[] args) {

        ArrayList<Credentials> allUsers = new ArrayList<Credentials>();
        displayMainMenu mainMenu = new displayMenu();
    }

    private void displayMainMenu() {
        int input;
        do {
            System.out.println("Menu Options");
            System.out.println("[1] Login");
            System.out.println("[2] Register");
            System.out.println("[0] Quit");//5 Displaying Main Menu Options
            Scanner sc = new Scanner(System.in);
            input = sc.nextInt();

            if (input > 2) {
                System.out.println("Please enter a value of [0] - [2]");
            }
            else if (input == 1){
                System.out.println("Login");
            }
            else if (input == 2){
                System.out.println("Register");
            }
            else if (input == 0){
                System.out.println("Thank you. bye.");
            }
        }while(input >= 2);
    }
}