Class-Enum Hybrids
An Introduction with Examples in Java |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Color
class
contains instances like Color.RED
,
Color.GREEN
, ...)Color
class that includes
an instance that couldn't be represented by the color model
being used; an upper/lower bound on an ordered set that is
not an element of the set)
Temperature
objects for equipment that
can be used for heating and/or coolingpublic
:
final
:
static
:
==
(though can
be compared with the equals()
method)equals()
methodequals()
methodequals()
Method Revisited
enum
Month
Enum as a ClasscompareTo()
ordinal()
valueOf()
values()
Month
Class