I’m a student and I’m new to Java, this assignment I am doing is the first assignment I have to do that has to strictly follow oop conventions. So this may be a newb question. When coding a menu, would it be appropriate to put the menu code in the main method or should it be in a class and instantiated along with everything else?
EDIT:
The menu menu is a simple command line menu that is inputed with numbers, no gui. Not that far yet.
If you want to strictly follow the OOP convention you could have your own class like
So that you can have a subclass specific for every menu item that has its behavior.
Then you could have a menu container, something like:
that should understand which voice has been chosen according to the stdin input and execute it. Of course you can enrich everything by having a default text for every menu item and whatever. Then in your main method you just instantiate the menu and take care of forwarding stdin input to it.
Mind that this is usually overkill in a simple menu but if you want to understand OOP then it’s a nice way to go.