Created
April 24, 2016 04:54
-
-
Save tigawa/89aee8b536bb22b216117f1c7d107dcc to your computer and use it in GitHub Desktop.
列挙型のサンプル
This file contains 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
package com.tigawa; | |
public enum Month { | |
Apr(4), | |
May(5), | |
Jun(6), | |
Jul(7), | |
Aug(8), | |
Sep(9), | |
Oct(10), | |
Nov(11), | |
Dec(12), | |
Jan(1), | |
Feb(2), | |
Mar(3); | |
private int month; | |
private Month(int month){ | |
this.month = month; | |
} | |
public int getMonth(){ | |
return this.month; | |
} | |
public int getPeriod(){ | |
return ordinal()+1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment