I have a Menu
class with a method that displays a menu, stores and then returns the selection made by the user.
public class Menu {
public static int menuSelect(){
Scanner input = new Scanner(System.in);
System.out.println("Hello, Please Select A Function: ");
System.out.println("1) Sort All Banks Alphabetically ");
System.out.println("2) Calculate Interest And Show Balance ");
System.out.println("3) Transfer Money ");
System.out.println("4) Exit ");
int Select = input.nextInt();
return Select;
}
}
I want to use the return value in my main method but im not sure how. I have made an object in my main method by saying:
Menu menuObject = new Menu();
and by adding:
Menu.menuSelect();
I know that the menu runs but i want to get the return value from return Select in a variable in my main class. Any help would be much appreciated.