Flashcards
Enum
Cards in this deck (3)
- 1What is an enum?- Non primitive data type
- Fixed set of constants. It is static and final.
- All constants are static and final implicitly
- Implicitly extend java.lang.Enum
- implicitly public static and final - 2Declaring an enum- Write the enum variables tall
- As it is static you can access it using the enum name
- Cannot create child enum since it is final
- Cannot declare enum inside a method - 3Methods in enum- values() return all values present inside enum
ordinal() returns the enum constant index
valueOf() returns enum constant of the specified string value
Information
- Description
- Flashcards on Enum, created by BLU BLU on 29/01/2025.
- Created by
- BLU BLU
- Views
- 0
- Rating