Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
What is the use of colon ":" symbol in assigning the values for Enum ?
pradeep rajkumar
Greenhorn
Posts: 10
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
public class TestDays { public enum Days { MON, TUE, WED }; public static void main(String[] args) { for(Days d : Days.values()) ; Days [] d2 = Days.values(); System.out.println(d2[2]); } }
in line number 6 it is given with a colon symbol like this,
for(
Days d : Days.values()
)
so what does that intended to do ?
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
It is simply one of the formats of a for-loop. It has nothing todo with enums.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
pradeep rajkumar
Greenhorn
Posts: 10
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yup, I just now found it.
Its a kind of "For Each" loop in
java
.
Thank you.!!!
Don't get me started about those stupid
light bulbs
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Behaviour of Enums
Enums and operators
enum question from K&B
doubt in enums...anyone please help me out
Need Clarity about Enum???
More...