title: How to assign a "null" value to a single element in an int[] array in Java
body: <p>Is it possible to assign a "null" value to a single element inside an integer array?</p>
  
  <p>For example:</p>
  
  <pre><code>int[] num = new int[3];
  
  num[0] = 23;
  num[1] = null;
  num[2] = 12
  </code></pre>
  
  <p>When I tried this it gives an error viz. <code>incompatible types: &lt;nulltype&gt; cannot be converted to int</code></p>
  
  <p>But when I tried same in an Object array, I can assign a "null" value to a single element inside an array.</p>
  
  <p>Below is the code:</p>
  
  <pre><code>public class Person {
      private String name;
      private int age;
  
      public Person(String n, int a){
          name =  n;
          age = a;
      }
  
      public static void main(String[] args) {
          Person[] p = new Person[3];
          p[0] = new Person("John", 17);
          p[1] = null;
          p[2] = new Person("Mark", 18);
      }
  }
  </code></pre>
  
  <p>"null" is allowed in an Object array, while in an int array it is not. Why is that? What's the difference between those two array types? I thought all arrays in Java are of an Object type. Please do correct me if I'm wrong here.</p>