File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes please explain - code output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "please explain - code output" Watch "please explain - code output" New topic
Author

please explain - code output

jibs parap
Ranch Hand

Joined: Dec 07, 2004
Posts: 134
This is one of questions from master mock exam. can you explain how to arrive at th eoutput please.
--------------------

Michael Ku
Ranch Hand

Joined: Apr 20, 2002
Posts: 510
have you tried to run the code in a debuggerto see what is happening?
jibs parap
Ranch Hand

Joined: Dec 07, 2004
Posts: 134
I tried with my own debugs but failing to understand the concept.
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

See if this helps.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
jibs parap
Ranch Hand

Joined: Dec 07, 2004
Posts: 134
That's been quite helpful. Thanks very much MArk for your time.
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Well, If you have a eclipse IDE [Open source www.eclipse.org] just put a break point and you will be able to trace the code.
Or better would be to take a pen and paper and note down the values of x and z after each iteration.

Thanks
Deepak


SCJP, SCWCD, SCBCD
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
Also ordinal()
public final int ordinal()
Returns the ordinal of this enumeration constant (its position in its enum declaration, where the initial constant is assigned an ordinal of zero). Most programmers will have no use for this method. It is designed for use by sophisticated enum-based data structures, such as EnumSet and EnumMap.

Returns:
the ordinal of this enumeration constant

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html#ordinal()

Thanks
Deepak
 
 
subject: please explain - code output