• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need help on Constant Specific Class Body

 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




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
 
Matthew Brown
Bartender
Posts: 4565
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try printing out the value of CoffeeSize.OVERWHELMING.getLidCode().
 
Roel De Nijs
Sheriff
Posts: 9795
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs ,
could you illustrate with a working example.im confused as im new to enums.Please.


Regards,
Deepak Lal
 
Roel De Nijs
Sheriff
Posts: 9795
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you already tried? Maybe you can start with having a look at the Enum class.
 
Deepak Lal
Ranch Hand
Posts: 561
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roel De Nijs
Sheriff
Posts: 9795
101
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic