Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of enums in Java API

Tags:

java

enums

Could you point me out to a class, from official Java API that has a good use of enums ? I could not find any specific class.

Does the Java API incorporates enums in their classes at all?

like image 915
jellyfication Avatar asked Dec 20 '22 12:12

jellyfication


1 Answers

There are 328 enum classes defined in the JRE 7. I suggest you read the Enum Types tutorial

A simple one I have used is java.nio.AccessMode.

An enum worth understanding is Thread.State

A more interesting one is java.util.concurrent.TimeUnit

An example of a class which IMHO would be an enum but predates them is ByteOrder See Joachim's comment above.

like image 57
Peter Lawrey Avatar answered Jan 02 '23 22:01

Peter Lawrey