#2 enum + cmsc131 review Flashcards
(6 cards)
1
Q
enumerated types
A
specifies all possible values by listing them (use to represent small sets that you know all the values of)
(fields and methods can be added to enums)
2
Q
enum example
A
public enum GiraffeType (NORTHERN, SOMALI, SOUTHERN, MASAI}
3
Q
3 enumerated type methods
A
valueof()
name()
compareTo()
4
Q
how to use an enum outside of the class where it is declared
A
Classname.EnumTypeName.ENUMVALUE
5
Q
object oriented principles
A
abstraction (hiding details, describing in simple terms)
encapsulation (confining/grouping info inside something in a program)
makes it easier for you, b/c JavaLovesYou
6
Q
this refers to…
A
the current object