title: NullPointerException while calling static method of static subclass
body: <pre class="lang-java prettyprint-override"><code>class A {
      public static class B {
          private static String[] names;
          public static void addName(int i, String name) {
              names[i] = name;
          }
      }
  }
  </code></pre>
  
  <p>Calling <code>A.B.addName(0,"test");</code> causes NullPointerException. I'm new to Java, so could anyone explain why? I wanted to fill the names array on the beginning of the app and make all instances of A use the same data.</p>