title: Print only certain elements in an Array
body: <p>I've been given the following array</p>
  
  <pre><code>   tests[] b = new tests[50];
  </code></pre>
  
  <p>So, there are some null elements in this array and I don't want to print those in my array. </p>
  
  <pre><code>  for(int i = 0; i &lt; b.length; i++){
       if(b[i] != null){
          System.out.println(b[i]);
       }
    }
  </code></pre>
  
  <p>So, this prints out '@251970e2' but I need to be able to print out each valid elements contents which should be like 'batman', 'joker', 'batgirl'</p>
  
  <p>Sorry if this has been answered previously, I had a look but haven't had much luck :( </p>