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.
object is a reference variable of type Object array. now this object reference variable refers to a CONTAINER with 5 elements of type Object. each of the 5 references of the type Object points to a String array with five elements. this is possible because a reference of type Object can refer to any object, hence it is able to refer to String array. even if you do Object object = new String it would be compile.
Joined: May 28, 2010
Thanks gurpeet. One more Q.
how is the answer 1 here ? it should be "devil boast devil boast" right ? or i am missing something ..
correct answer is A only. you are missing a very small part. just a hint and try for yourself. what happens when you create new Boast(eye) object. ? what is the sequence ?
post if you got the answer.
Joined: May 28, 2010
got it .. Boast(eye) calls the default no-arg constructor of Devil class .. i was thinking it will call Devil(eye) .. but that would require a explicit call to super(eye) ... humm.. what was i thinking :-) thanks gurpeet
this is what happens when you drink beer and take test :-)
the special consideration is because of the fact that a reference of the type Object can refer to anything.
forget any of above . consider this
Object obj = new String;
above will compile because of the simple reason that obj is of the type Object which can ofcourse refer to objects of the type Object. since arrays are one of them(i.e. objects) it can refer to them.
when you write Object  obj = new String; this is just an extension of above thing. here you have an array of references of the type Object each of which are able to refer to string array
String  str = new String; here you have a str which is of the type String array . it points to a container which contains references of the type String which must refer to string array which of course is not possible.