title: Can Java object arrays initialize elements as non-null values?
body: <p>I'm pretty new at Java and I'm having a tough time figuring out how to fix this null pointer exception that has been troubling me.</p>
  
  <p>I know where the problem occurs and I know what a null pointer exception is, but I have no idea how I'm going to make my program work.</p>
  
  <p>Here's the code snippet where the problem is occuring:</p>
  
  <pre><code>public static void main(String[] args) {
   Scanner input = new Scanner(System.in);
  
      Account[] atm = new Account[10];
  
      for (int i = 0; i &lt; 10; i++){
          atm[i].setId(i);
          atm[i].setBalance(100.00);
      }
  </code></pre>
  
  <p>Like I said, I know that it happens because the objects in atm[] are null, but I'm not sure how to fix the problem.</p>
  
  <p>I'm sure it's some silly mistake because those are the kinds of mistakes I make on a regular basis, but any help that you guys can give would make my day.</p>
  
  <p>Thanks!</p>