Enums Flashcards

1
Q

Positionsnummer eines enum Elements ermitteln

A

int ordinal()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name eines enum Elements ermitteln

A

String toString()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Anzahl der enum Elemente ermitteln

A

int values().length

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Enum Element anhand eines index ermitteln

A

EnumName.values()[index]

Auf das letzte Element wird mit values().length - 1 zugegriffen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly