How to get value from a Java enum : <p>I have a enum which looks like:</p>

<pre><code>public enum Constants{
  YES("y"), NO("N")
  private String value;

  Constants(String value){
    this.value = value;
  }
}
</code></pre>

<p>I have a test class which looks like</p>

<pre><code>public class TestConstants{
 public static void main(String[] args){
   System.out.println(Constants.YES.toString())
   System.out.println(Constants.NO.toString())
 }
}
</code></pre>

<p>The output is:</p>

<pre><code>YES
NO
</code></pre>

<p>instead of </p>

<pre><code>Y
N
</code></pre>

<p>I am not sure what is wrong here ??</p>
