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