valueOf function of enum

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Time
    New Member
    • Jan 2010
    • 77

    valueOf function of enum

    Code:
    enum birds
    {
     parrot,cock,hen,sparrow
    }
    class demo
    {
     public static void main(String b[])
     {
        System.out.println(birds.valueOf("parrot")); 
        System.out.println(birds.parrot);
     }
    }
    Output is:
    parrot
    parrot.. i cant find any use of valueOf function of enum..Does someone know any practical use of this method?
Working...