title: How can I check if a variable exists in Java?
body: <p>I want to write to a variable only if there isn't anything already there. Here is my code so far.</p>
  
  <pre><code>if (inv[0] == null) {
      inv[0]=map.getTileId(tileX-1, tileY-1, 0);
  }
  </code></pre>
  
  <p>It gives me this error:</p>
  
  <pre><code>java.lang.Error: Unresolved compilation problem: 
  The operator == is undefined for the argument type(s) int, null
  </code></pre>