Virajsinh

Java_09

Feb 11th, 2018
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. //Write a program to explain concept of enum
  2.  
  3. //both declaration its work
  4. //enum season {Winter, Spring, Summer, Fall}
  5.  
  6. class Ex9 // Ex9 is FileName
  7. {
  8.     enum season {Winter, Spring, Summer, Fall} 
  9.        
  10.     public static void main(String args[])
  11.     {
  12.         //Syntax
  13.         //enum_name variable_name = enum_name.value;
  14.         season a = season.Winter;
  15.         season b = season.Spring;
  16.         season c = season.Summer;
  17.         season d = season.Fall;
  18.        
  19.         System.out.println(a);
  20.         System.out.println(b);
  21.         System.out.println(c);
  22.         System.out.println(d);
  23.        
  24.     }
  25. }
Add Comment
Please, Sign In to add comment