title: static and non static methods in java
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/48755/when-should-a-method-be-static">When should a method be static?</a>  </p>
  </blockquote>
  
  
  
  <p>i am trying to make an interface class for tube/subway ticket machine. well not for real, but for a coursework in a computer science module. i dont understand when to use static methods. i dont know much about computer sciences, but main methods seem to use static.  </p>
  
  <pre><code>class UNInterfaceTest
  {
     public static final int NOTTING_HILL = 1;
     public static final int HIGH_KEN = 2;
     public static final int GLOUS = 3;
     public static final int SOUTH_KEN = 4;
     public static final int SLOANE = 5;
     public static final int VICTORIA = 6;
     public static final int ST_JAMES = 7;
     public static final int WESTMINSTER = 8;
     public static final int QUIT = 10;
     private Input in = new Input();
  
  private static void displayMenu()
  {
     System.out.println("CIRCLE LINE: Please Select the Number of Your Current Station.");
     System.out.println(NOTTING_HILL + ": Nottinghill_Gate");
     System.out.println(HIGH_KEN + ": High_Street_Kensignton");
     System.out.println(GLOUS + ": Gloucester_Road");
     System.out.println(SOUTH_KEN + ": South_Kensignton");
     System.out.println(SLOANE + ": Sloane_Square");
     System.out.println(VICTORIA + ": Victoria"); 
     System.out.println(ST_JAMES + ": St_James_Park");
     System.out.println(WESTMINSTER + ": Westminster");
     System.out.println();
     System.out.println(QUIT + ". Quit");
  }
  
  public static void run()
  {
      while(true)
      {
          displayMenu();
          int option = getMenuInput();
          if (option == QUIT)
      {
          break;
      }
      doOption(option);
      }
   }
  
  private static void doOption(int option)
  { 
      switch(option){
   case NOTTING_HILL:
       //findNottinghill_Gate();
         break;
        case HIGH_KEN:
       //findHighStreetKensignton();
         break;
        case GLOUS:
       //findGloucesterRoad();
         break;
        case SOUTH_KEN:
       //findSouthKensignton();
         break;
        case SLOANE:
       // findSloaneSquare();
         break;
        case VICTORIA:
       //findVictoria();
         break;
        case ST_JAMES:
       //findStJamesPark();
         break;
        case WESTMINSTER:
        //findWestminster();
         break;
        default:
          System.out.println("Invalid option - try again");
      }
  } 
  private int getMenuInput()
  {
      //KeyboardInput val = new KeyboardInput();
      System.out.print("Enter menu selection: ");
      int option = in.nextInt();
      in.nextLine();
      return option;
  }
  
   public static void main(String[] args)
   {
      run();
   }
  }
  </code></pre>