Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write a program to explain concept of enum
- //both declaration its work
- //enum season {Winter, Spring, Summer, Fall}
- class Ex9 // Ex9 is FileName
- {
- enum season {Winter, Spring, Summer, Fall}
- public static void main(String args[])
- {
- //Syntax
- //enum_name variable_name = enum_name.value;
- season a = season.Winter;
- season b = season.Spring;
- season c = season.Summer;
- season d = season.Fall;
- System.out.println(a);
- System.out.println(b);
- System.out.println(c);
- System.out.println(d);
- }
- }
Add Comment
Please, Sign In to add comment