Page 1 of 1
About Question enthuware.ocajp.i.v7.2.865 :
Posted: Thu Dec 13, 2012 6:20 pm
by ETS User
I was thrown by the fact that main() is declared as throwing an Exception, yet the Data class wasn't throwing any. I was expecting a compiler error as a result.
Re: About Question enthuware.ocajp.i.v7.2.865 :
Posted: Thu Dec 13, 2012 6:48 pm
by admin
A method can be defined to throw any exception even though the code inside it does not throw that exception.
HTH,
Paul.
Re: About Question enthuware.ocajp.i.v7.2.865 :
Posted: Fri Jan 11, 2013 3:13 pm
by deepa.patre
I just had a doubt with the answer.
how the output is 10Y 0Z ?
i got the point of 10Y but why it is 0Z instead of 10Z because the value of x is changed to 10 when the first object is called because objects are passed by reference...
Please advise!
Re: About Question enthuware.ocajp.i.v7.2.865 :
Posted: Sat Jan 12, 2013 12:25 pm
by admin
There are two Data objects. The first one is created with int 10 and the second one is created with string "Z". Where do you see x being changed to 10 for the second Data object?