title: how to make scanner object as static
body: <p>how can i refer to Scanner object which is defined globally from a static method(say main() ).. That is, how to make Scanner object as static.</p>
  
  <p>Program (# for reference to my problem) :</p>
  
  <pre><code>import java.util.Scanner;
  
  class spidy {
  
      Scanner input = new Scanner(System.in);             /*DECLARING SCANNER OBJECT OUTSIDE MAIN METHOD i.e Static method */
  
  
      public static void main(String args[]) {
  
          System.out.println("Enter a number");
          int n = input.nextInt();
      }
  }
  </code></pre>
  
  <p>Error: 
  non static variable input cannot be referenced from the static content</p>