Created
February 23, 2012 05:22
-
-
Save maxp/1890596 to your computer and use it in GitHub Desktop.
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
| // use enums to implement an interface. | |
| public interface Room { | |
| public Room north(); | |
| public Room south(); | |
| public Room east(); | |
| public Room west(); | |
| } | |
| public enum Rooms implements Room { | |
| FIRST { | |
| public Room north() { | |
| return SECOND; | |
| } | |
| }, | |
| SECOND { | |
| public Room south() { | |
| return FIRST; | |
| } | |
| } | |
| public Room north() { return null; } | |
| public Room south() { return null; } | |
| public Room east() { return null; } | |
| public Room west() { return null; } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment