The switch you are attempting to you would allow you to discern the element of the enum. So if you did a switch on an instance of fruit, you could use cases of APPLE or ORANGE.
Fruit and Veg are essentially different classes. If you wanted to tell if an Object was a String or an Integer how would you do it? You would use the instanceof operator (also known as Type Comparison operator). The same is true with the fruit and veg.
I'd reccomend having a read of the section of the sun tutorial that gives an introduction to the instanceof operator.
Joined: Oct 17, 2008
This is exactly what I was trying to get. Thank you very much!