This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
corrected your code so that it should compile
you left a blankspace(whitespace) in your class name
here the for loop is ineffective on the output of the program
since it ends up at next line see there are no openinig closing curly braces around the for loop
values() is a static method which gets the value of enum according to their index d2
here we are providing index 2 which is WED in your enum
thus the output is WED
hope this solves your problem.
dilip kumarr wrote:
kathy sierra question doubt scjp 1.6
anyone please help me solving this code..... please explain in detail, dont forget to explain code no.4 and 6
thanks in advance
it a simple code.............
donot panic for this
for (Days d: Days.values() ); is doing is it is putting all the values of enum into a array days............if you remove this.......ur code will also compile fine............try it...
Days  d2 = Days.values();
so,when you see d2..........it will pring d2 at index 2 which is WED