title: Handling multiple menu inputs java - returning to while loop in main?
body: <p>I'm trying to design a program that has a menu and essentially for the duration of the program handles input from that menu. I have another menu that may be called by another class that may interrupt the flow of this program and call another method, which displays another menu. Is there a way to transfer this control back to the while loop inside main to continue handle the input, when the display menu is called from another class, or would it be more sensible to write this entirely differently?</p>
  
  <p>The code is just an example of how this is currently being structured. Currently I've tried setting a flag when the other class wants to call displayNewMenu, and checking for this flag in the while loop, and calling it from there, but this seems not to be working.</p>
  
  <pre><code>public static void main(String[] args) {
      displayMenu();
      while(true) {
          handleMenuInput();
  }
  
  public void displayNewMenu() {
  }
  </code></pre>