File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes A question from Mock Exam Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "A question from Mock Exam" Watch "A question from Mock Exam" New topic

A question from Mock Exam

Jisha Anand
Ranch Hand

Joined: Apr 02, 2009
Posts: 62

Dear All,

I encountered the following question while attempting a practice test in

The answer given was: Choices B and C are the correct answers.

Is this correct?
Of course C is correct; but if B is correct the case when x == y will make z = x; where as in the given code z = y for the same case right?
I thought the question was an easy one; but now confused Please help!

Jhakda Velu
Ranch Hand

Joined: Feb 26, 2008
Posts: 167
taking option b
the end result is still the same
whether z=x or z=y, both the answers will be the same,right?


If I become filthy rich, I'll sponsor research for painless dental treatment at Harvard Medical School. Thats why,I'm learning Java.I have 32 teeth, 22 are man made.
Prabz Bhatia

Joined: Apr 14, 2009
Posts: 19
myself got confused in this one at first...

when x==y, does it matter what it returns??? Because x and y are the same!!!..

Jisha Anand
Ranch Hand

Joined: Apr 02, 2009
Posts: 62 stupid i am

thanks a lot!
I agree. Here's the link:
subject: A question from Mock Exam
It's not a secret anymore!