jQuery in Action, 2nd edition*
The moose likes Associate Certification (OCAJP 7) and the fly likes Need help on Constant Specific Class Body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Associate Certification (OCAJP 7)
Bookmark "Need help on Constant Specific Class Body" Watch "Need help on Constant Specific Class Body" New topic
Author

Need help on Constant Specific Class Body

Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507





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


When The Going Gets Tougher,The Tougher gets Going
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4343
    
    8

Try printing out the value of CoffeeSize.OVERWHELMING.getLidCode().
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5131
    
  12

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.


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

Roel De Nijs ,
could you illustrate with a working example.im confused as im new to enums.Please.


Regards,
Deepak Lal
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5131
    
  12

What have you already tried? Maybe you can start with having a look at the Enum class.
Deepak Lal
Ranch Hand

Joined: Jul 01, 2008
Posts: 507

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
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3429
    
  12
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.

Joanne
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 5131
    
  12

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.
 
 
subject: Need help on Constant Specific Class Body
 
Similar Threads
How to call method which was in enum class
Constant Specific class body [ENUM]
Hard Exam question
Semicolon after enum constant declaration?