title: How to return to beginning of program - java
body: <p>I'm having trouble getting my code to return to the beginning of the code and restart when confirm is not equal to 1. I have tried the return function but it just repeats confirmed constantly and I'm not sure what to do.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class zoo {
      public static void main(String[] args) {
  
          int optionNumber = 0;
          int numberOfTickets = 0;
          int confirm = 0;
          int totalAmount = 0;
  
          int[] priceArray;
          priceArray = new int[3];
          priceArray[0] = 18;
          priceArray[1] = 36;
          priceArray[2] = (int) 32.50; 
  
          Scanner input = new Scanner (System.in);
  
          System.out.println("\t" + "@@@@@ Welcome to Zoos Victoria @@@@@");
          System.out.println("\t" + "\t" + "MAIN MENU" + "\n");
          System.out.println("\t" + "Zoo has the following ticketing options" + "\n");
          System.out.println("\t" + "1 = Child (4-6 yrs");
          System.out.println("\t" + "2 = Adult (16+ yrs");
          System.out.println("\t" + "3 = Senior (60+ yrs" + "\n");
  
          System.out.println("Enter your option:" );
          optionNumber=input.nextInt();
  
           if(optionNumber == 1) {
              System.out.println("Enter total No of tickets for Child");
              numberOfTickets=input.nextInt();
          } else if (optionNumber == 2){
              System.out.println("Enter total No of tickets for Adult");
              numberOfTickets=input.nextInt();
          } else {
               System.out.println("Enter total No of tickets for Senior");
               numberOfTickets=input.nextInt();
          }
  
          System.out.println("Press 1 to confirm");
          confirm=input.nextInt();
  
          if (confirm ==1) {
              System.out.println("confirmed");
          } else {
  
          }
  
  
  
          if(optionNumber == 1) {
              totalAmount=priceArray[0]*numberOfTickets;
              System.out.println("Total amount for child tickets: $" + totalAmount);
  
          } else if (optionNumber == 2) {
              totalAmount=priceArray[1]*numberOfTickets;
              System.out.println("Total amount for adult tickets $" + totalAmount);
  
          } else {
              totalAmount=(int) ((double) priceArray[2]*numberOfTickets);
              System.out.println("Total amount for senior tickets $" + totalAmount);
          }
      }
  }
  </code></pre>