Skip to content

Instantly share code, notes, and snippets.

@hamstar
Created September 29, 2011 04:44
Show Gist options
  • Select an option

  • Save hamstar/1249991 to your computer and use it in GitHub Desktop.

Select an option

Save hamstar/1249991 to your computer and use it in GitHub Desktop.
Demonstration of a Java ENUM
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package Enums;
/**
*
* @author fwm8280
*/
public class TaskStatus{
public TaskStatus() {
System.out.println(TaskStatusEnum.CLOSED.getNumber());
}
public enum TaskStatusEnum {
OPEN (1), CLOSED (2), IN_PROGRESS (3);
private int number;
private TaskStatusEnum(int number) {
this.number = number;
}
public int getNumber() {
return number;
}
}
public static void main( String[] args ) {
new TaskStatus();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment