title: How to make a static array in main method in java?
body: <p>I was reading about arrays in java and I made a code for calculating the number of appearances of all numbers in an array . </p>
  
  <pre><code>public class Example {
  
      static int b[] = new int[13]; // I can not do static int b[] = new int[a.length] because a[] in not static array
      static int count = 0;
  
      public static void main(String[] args) {
          int[] a = { 2, 3, 4, 3, 3, 5, 4, 10, 9, 1, 9, 11, 15 };
          counting(a);
          printCount();
      }
  
      private static void printCount() {
          int k = 0;
          for (int i = 0; i &lt; b.length; i++) {
              System.out.print("number" + " " + a[k] + " " + "is found" + " "); // here I get error in a[k] because it is not static , eclipse says : a cannot be resolved to a variable
              System.out.println(b[i] + " " + "times");
              k++;
          }
          System.out.println();
  
      }
  
      private static void counting(int[] a) {
          for (int i = 0; i &lt; a.length; i++) {
              for (int k = 0; k &lt; a.length; k++) {
                  if (a[i] == a[k]) {
                      b[i] = ++count;
                  }
              }
              count = 0;
          }
  
      }
  }
  </code></pre>
  
  <p>I got stuck in my printCount() method , there I can not call my a[] array in the method because a[] is not static in the main method . 
  I tried to write <code>static int[] a = { 2, 3, 4, 3, 3, 5, 4, 10, 9, 1, 9, 11, 15 };</code> in my main method but eclipse does not accept that .
  How can I make a[] a static array so that can be reached in all methods in my Example class above ?</p>
  
  <p>Thank you</p>