wha is enum and when should we use it in java?

4 views
Skip to first unread message

amy

unread,
Nov 8, 2012, 7:21:17 PM11/8/12
to aksfo...@googlegroups.com

vivek maurya

unread,
Nov 9, 2012, 12:55:44 AM11/9/12
to aksfo...@googlegroups.com
An enum type is a type whose fields consist of a fixed set of constants.
Enum can be used whenever a set of constant is required.
Other alternative is int constants using int-enum patterns.
enum types are type-safe as you can not pass a same named constant of another set where enum type constant is required.

On Friday, November 9, 2012 5:51:17 AM UTC+5:30, amy wrote:
Reply all
Reply to author
Forward
0 new messages