Re: [问题] OCJP SE6题目 - enum

楼主: violet90079 (ˊ__>ˋ)   2017-02-20 00:19:26
※ 引述《uopsdod (pcman)》之铭言:
: Given:
: enum Exaplme {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.utilHash.Map; instead, the
: programmer must use a java.util.EnumMap.
: d. The Example values can be used in a java.tuil.SortedSet, but the set will
: NOT be sorted because enumerated types do NOT implement java.lang.Comparable
:
作者: uopsdod (pcman)   2017-02-20 21:01:00
感谢。 本来以为enum会重在内部自己新定义 < 算子。
作者: ssccg (23)   2017-02-21 07:15:00
java没有operator overloading,唯一较特别的只有string +
作者: uopsdod (pcman)   2017-02-21 23:49:00
感谢大家 了解了!
作者: adrianshum (Alien)   2017-02-23 09:38:00
唯“二”比较特别的是String 的 + 和+= :P

Links booklink

Contact Us: admin [ a t ] ucptt.com