Class and objects Flashcards
1
Q
What is an enum?
A
An enum is a data type that represents a group of constants (unchangeable variables, like final variables).
2
Q
There is an enum class called Fruits. It has a enum constant called ‘Apple’. How to access it?
A
Fruit myVar = Fruit.MEDIUM;
3
Q
What is a default constructor?
A
A constructor without parameters. If a class has no parameters java automatically provides a default constructor.
4
Q
A