This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Arun Arun Kumar wrote:Can someone explain what "Object objArray = new String;" actually signifies,
You are creating an array that can hold 3 String references, and assign it a reference of type Object. That's allowed because a String IS-A Object.
why we are not getting compile time error at line 3?
Because the compiler doesn't know the Object reference actually refers to a String object. The reference type is Object, and the compiler allows any Object reference to be an element of it. The JVM will complain at runtime though, because the JVM does know that the Object reference refers to a String object.