title: Beginner Java static scope error
body: <p>(For a beginner Java class) 
  The assignment specifies that i only make one Scanner instance, and I need it in more than one method, so i declared it outside of main. I declare an array and try to equate it with a method call, initialCash(), like I would in Python. The problem is if I make the initialCash method static, I can't use Scanner. If initialCash() isn't static, Eclipse is kind enough to tell me that it "cannot make a static reference to the non-static method." (in the money = initialCash(); line)
   How do I get around this?</p>
  
  <pre><code>package proj1;
  
  import java.util.Scanner;
  
  public class Project1 
  {
      Scanner scanner = new Scanner(System.in);
  
      public static void main(String[] args) 
      {
          int[] money = new int[4]; 
          money = initialCash();
  
      }   
      public int[] initialCash()
      {
          int[] initialMoney = new int[4];
  
          while(true)
          {
              System.out.print("Ones: ");
              initialMoney[0] = scanner.nextInt();
              System.out.print("Fives: ");
              initialMoney[1] = scanner.nextInt();
              System.out.print("Tens: ");
              initialMoney[2] = scanner.nextInt();
              System.out.print("Twenties: ");
              initialMoney[3] = scanner.nextInt();
  
              if((initialMoney[0]&gt;=0)&amp;&amp;(initialMoney[1]&gt;=0)&amp;&amp;(initialMoney[2]&gt;=0)&amp;&amp;(initialMoney[3]&gt;0))    
              {
                  return initialMoney;
              }
              else
              {
                  System.out.println("One or more invalid denominations. Try again.");
              }
          }
  
      }
  
  
  }
  </code></pre>