FAQs
Search
Recent Topics
Flagged Topics
Hot Topics
Best Topics
Register / Login
This week's book giveaway is in the
Cloud/Virtualization
forum.
We're giving away four copies of
Mastering Corda: Blockchain for Java Developers
and have Jamiel Sheikh on-line!
See
this thread
for details.
Win a copy of
Mastering Corda: Blockchain for Java Developers
this week in the
Cloud/Virtualization
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
Programmer Certification (OCPJP)
Switch Enum Question
Sandeep Vaid
Ranch Hand
Posts: 392
posted 14 years ago
package enums; public class Enum_Example_1 { enum Animal{HORSE,CAT,DOG}; public static void main(String args[]) { Animal animal = Animal.DOG; //Animal animal1 = DOG; switch(Animal.HORSE) { case CAT : break; case DOG : break; } } }
How come just saying CAT inside switch works?
wise owen
Ranch Hand
Posts: 2023
posted 14 years ago
Check this link
http://elliottback.com/wp/archives/2005/03/03/enumerated-constants-in-java/
.
14.11 The switch Statement
EnumConstantName: Identifier
[ October 28, 2006: Message edited by: wise owen ]
New rule: no elephants at the chess tournament. Tiny ads are still okay.
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Why can't we assign parent class object to child class reference?
Creating Objects
Reg. casting from Khalid Mughal
ClassCastException
invalid cast exception
More...