Created
January 12, 2018 11:33
-
-
Save pozdneev/31be2844051cb2dd446bba458daa43eb to your computer and use it in GitHub Desktop.
Demonstrates the String representation of a Java enum
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
public class SpeakingEnum { | |
public static enum SPEAKING_ENUM { | |
SOME_VALUE, | |
SOME_OTHER_VALUE; | |
public void speak() { | |
System.out.println("this=" + this); | |
} | |
} | |
public static void main(String [] args) { | |
SPEAKING_ENUM se1 = SPEAKING_ENUM.SOME_VALUE; | |
SPEAKING_ENUM se2 = SPEAKING_ENUM.SOME_OTHER_VALUE; | |
se1.speak(); | |
se2.speak(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment