Forums Register Login

Need help on Constant Specific Class Body

+Pie Number of slices to send: Send




This is an example of Constant Specific Class Body ,how do i execute this and see the resultant output.
Appreciated if you could help me.
Courtesy:SCJP Exam 310-065,Page No:65.



HTH
Deepak Lal
+Pie Number of slices to send: Send
Try printing out the value of CoffeeSize.OVERWHELMING.getLidCode().
1
+Pie Number of slices to send: Send
Or you could write a little program that iterates over each value of your enum printing the name and the lid code of each constant.
+Pie Number of slices to send: Send
Roel De Nijs ,
could you illustrate with a working example.im confused as im new to enums.Please.


Regards,
Deepak Lal
+Pie Number of slices to send: Send
What have you already tried? Maybe you can start with having a look at the Enum class.
+Pie Number of slices to send: Send
 

Roel De Nijs wrote:Or you could write a little program that iterates over each value of your enum printing the name and the lid code of each constant.



@Roel, can you help me to execute this example.it would be helpful to understand the working example.i do not know how to proceed.in case you can post the working example it will ne helpful and appreciated.

Regards,
Deepak Lal
+Pie Number of slices to send: Send
After nearly 500 posts and 5 years on the ranch surely you have been pointed to the Oracle java tutorials before. There's sample code in there demonstrating exactly what Roel suggested.
+Pie Number of slices to send: Send
 

Deepak Lal wrote:i do not know how to proceed.in case you can post the working example it will ne helpful and appreciated.


I'm sure you'll learn more if you try it yourself instead of asking a working example. Besides that we are NotACodeMill. If you have some issues with the sample code, we are here to help you. But you always have to ShowSomeEffort, so provide us the code snippet you already wrote and the problems/issues you have to complete it to a working example.
I don't always make ads but when I do they're tiny
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 927 times.
Similar Threads
How to call method which was in enum class
Hard Exam question
Semicolon after enum constant declaration?
Constant Specific class body [ENUM]
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 07:56:18.