About Question enthuware.ocajp.i.v7.2.865 :
Moderator: admin
About Question enthuware.ocajp.i.v7.2.865 :
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.
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.865 :
A method can be defined to throw any exception even though the code inside it does not throw that exception.
HTH,
Paul.
HTH,
Paul.
-
- Posts: 15
- Joined: Thu Dec 13, 2012 9:44 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.865 :
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!
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!
-
- Site Admin
- Posts: 10386
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.865 :
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?
Who is online
Users browsing this forum: No registered users and 9 guests