File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Certification Results and the fly likes ocjp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Certification Results
Bookmark "ocjp " Watch "ocjp " New topic
Author

ocjp

Dasaradhi Nidumolu
Greenhorn

Joined: Feb 07, 2013
Posts: 1
enum Example { ONE, TWO, THREE }
Which statement is true?
A. The expressions (ONE == ONE) and ONE.equals(ONE) are both guaranteed to be
true.
B. The expression (ONE < TWO) is guaranteed to be true and ONE.compareTo(TWO) is
guaranteed to be less than one.
C. The Example values cannot be used in a raw java.util.HashMap; instead, the
programmer must use a java.util.EnumMap.
D. The Example values can be used in a java.util.SortedSet, but the set will NOT be
sorted because enumerated types do NOT implement java.lang.Comparable.

The answer is given as A. Will you please explain why not B?
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9622
    
    2

Dasaradhi Nidumolu wrote:enum Example { ONE, TWO, THREE }
Which statement is true?
A. The expressions (ONE == ONE) and ONE.equals(ONE) are both guaranteed to be
true.
B. The expression (ONE < TWO) is guaranteed to be true and ONE.compareTo(TWO) is
guaranteed to be less than one.
C. The Example values cannot be used in a raw java.util.HashMap; instead, the
programmer must use a java.util.EnumMap.
D. The Example values can be used in a java.util.SortedSet, but the set will NOT be
sorted because enumerated types do NOT implement java.lang.Comparable.

The answer is given as A. Will you please explain why not B?


You might better attract people to your posts if you post your question in the right forum. Take a look here https://www.coderanch.com/how-to/java/HowToAskQuestionsOnJavaRanch


SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ocjp