CAn anyone explain about "Enum" in ?.I read some some article but i could not get the correct point.
2) I like to have a varialbe which contain 4 or 5 element ,at runtime i will give value for this variable,For example variable loom ,it has elements color,manufacture,....).PLease explain ,how can i create variable which has many elements
if you look closely it's kinda like a class! it has fields and methods to change behavior. like everything else in java Enum's are zero indexed so ...
which could come in pretty handy when you're trying to index a data structure like and array or vector. finally if you look at the PaperCurrency Enum we actually can add a value to the element; in this case the primitive (int). the field:
refers to the value stored in each element ie One(1), Five(5), etc.
the accessor method getValue() returns these when called on the appropriate element. since Enums are object you can test for uniqueness with instanceof. i hope this helps a little. [ April 15, 2008: Message edited by: f. nikita thomas ]
Imagination is more important than knowledge "Albert Einstein"
An enum is a type whose fields consist of a fixed set of constants. Enums were introduced in Java 5.0. If you are using a version lower than JDK 1.5 then you won't be able to harness the power of enums.