Skip to content

Instantly share code, notes, and snippets.

@kunxin-chor
Created September 5, 2024 11:29
Show Gist options
  • Save kunxin-chor/e6366f9e6c1489e29248cfd32416deb5 to your computer and use it in GitHub Desktop.
Save kunxin-chor/e6366f9e6c1489e29248cfd32416deb5 to your computer and use it in GitHub Desktop.
Main.java template
public class Main {
public static void main() {
while (true) {
displayMenu();
int choice = getMenuChoice();
boolean keepRunning = processChoice(choice);
if (keepRunning == false) {
break;
}
}
}
public static void displayMenu() {
}
// get the choice that the user has entered
public static int getMenuChoice() {
return 0;
}
// depending on the user has entered at the menu, do something
// if return true, keep running the program
// if return false, quit the program
public static boolean processChoice(int choice) {
return false;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment