Grokking Java Interview Questions
0% completed
Enums
An enum is a class whose objects are listed in its own declaration, and no other objects of that class can be created. The declaration enum OrderStatus { NEW, PAID, SHIPPED, CANCELED } therefore defines a type and exactly four objects of it.
Most properties of enums follow from this one restriction. The first question compares enums with plain integers, and the second shows what else an enum declaration may contain. The last two cover the collections that are made for enums and the use of one enum by several threads.
.....
.....
.....
Like the course? Get enrolled and start learning!
Reading Progress
0%