Quantcast
Channel: Examples Java Code Geeks » Enum
Browsing all 5 articles
Browse latest View live

Enum for Singleton and Utility class

enum Singleton { INSTANCE; } enum Utility { ; // no instances } Related Article: Java Secret: Using an enum to build a State machine Reference: Java Secret: Using an enum to build a State machine from...

View Article



Enum to implement an interface

With this example we are going to demonstrate how to use an enum to implement an interface. Implementing an interface with an enum can be useful when we need to implement some business logic that is...

View Article

Each Enum Instance a different sub-class

In this example we shall show you how to have each enum instance represent a different sub-class. To make each enum instance represent a different sub-class one should perform the following steps:...

View Article

Using an enum as a state machine

In this short example, a parser state machine processes raw XML from a ByteBuffer. Each state has its own process method and if there is not enough data available, the state machine can return to...

View Article

Java Enumeration example

In this tutorial we will discuss about enumerations in Java. The Java programming language contains the enum keyword, which represents a special data type that enables for a variable to belong to a set...

View Article

Browsing all 5 articles
Browse latest View live




Latest Images