Wednesday 15 July 2015

What does the object creation statement in java exactly means? -



What does the object creation statement in java exactly means? -

assuming x , y both class.what below statements means?

x obj1 = new x(); x obj2 = new y();

whose reference , memori given in above case? please elaborate!

this creates object of type x , assigns reference variable called obj1.

it creates object, time of of type y, , assigns reference variable called obj2.

for sec line compile, y has subclass of x.

java

No comments:

Post a Comment