Array of "Object" class : <p>Despite the fact that you lose the typing security, is it bad to use primitive Object class arrays to be able to have a multi-typed array?</p>

<p>Code to understand:</p>

<pre><code>public class testobject {

    public static void main (String[] args){

        Object[] obj = new Object[5];
        obj[0] = "Cat";
        obj[1] = 7;
        obj[2] = new Object();

        for(int i = 0; i &lt; obj.length; i++){
            System.out.println(obj[i]);
        }

    }

}
</code></pre>
