title: Is there a way that i can loop this program to start all over again after it executes part of a loop
body: <p>Ok, I am new to Java and I'm encountering a problem. I'm trying to make the program start all over again from the main when a certain section of the switch statement has finished executing. This is my code:</p>
  
  <pre><code>import java.util.Scanner;
  public class Test{
  public static void main(String[] args){
      Scanner input = new Scanner(System.in);
      int ans;
      System.out.println("Choose an option");
      System.out.print("1: To see members\n2: To add member\n3: To delete a member\n Option: ");
      ans = input.nextInt();
  
      switch(ans){
          case 1:
          //code to see members
          break;
          case 2:
          //code to add members
          break;
          case 3:
          //code to delete members
          break;
          default:
          System.out.println("Invalid option");
          }
       }
   }
  </code></pre>
  
  <p>After case one finishes executing, the program exits. How do I pass control back to the main so that it can start allover again until the user exits on purpose?</p>