Created
September 29, 2011 04:44
-
-
Save hamstar/1249991 to your computer and use it in GitHub Desktop.
Demonstration of a Java ENUM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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