You need to make both your method - printMenu()
and getUserChoice()
static
, as you are directly invoking them from your static main
method, without creating an instance of the class, those methods are defined in. And you cannot invoke a non-static
method without any reference to an instance of the class they are defined in.
Alternatively you can change the method invocation part to:
BookStoreApp2 bookStoreApp = new BookStoreApp2();
bookStoreApp.printMenu();
bookStoreApp.getUserChoice();