title: "The array is only written to, never read from" error showing in Java code
body: <p>I've been trying to polish up on some Java and I'm trying to refresh the basics so I've been working through the Sam's 24 hour java book. One of the projects to familiarize yourself with describing objects gives the code as follows:</p>
  <pre><code>package com.java24hours;
  
  public class GremlinLab {
      public static void main(String[] arguments) {
          int numGremlins = Integer.parseInt(arguments[0]);
          if (numGremlins &gt; 0) {
              Gremlin[] gremlins = new Gremlin[numGremlins];
              for (int i = 0; i &lt; numGremlins; i++) {
                  gremlins[i] = new Gremlin();
              }
              System.out.println(&quot;There are &quot; + Gremlin.getGremlinCount()
                  + &quot; gremlins.&quot;);
          }
      }
  }
  </code></pre>
  <p>The error &quot;The array is only written to, never read from&quot; is showing upon compilation in the 7th line:</p>
  <pre><code>Gremlin[] gremlins = new Gremlin[numGremlins];
  </code></pre>
  <p>and I can't figure out for the life of me why this is not working! Apologies if I'm being stupid but any help will be greatly appreciated :) Thanks!</p>
  <p>Sorry quick edit to add the other class I haven't mentioned!!</p>
  <p>I have also got the following class:</p>
  <pre><code>package com.java24hours;
  
  public class Gremlin {
      static int gremlinCount = 0;
  
      public Gremlin() {
          gremlinCount++;
      }
  
      static int getGremlinCount() {
          return gremlinCount;
      }
  }
  </code></pre>
  <p>I then specified the command-line arguments by customizing the project configuration.</p>
  <p>Last Edit!!...
  Thanks very much everyone, I really appreciate it. I'm using an IDE and moved the classes to the source packages folder rather than the 'com.java24hours' package....and my original codes have worked fine?! Clearly I'm very much a novice! Thanks again all :)</p>