• 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

Need help on Constant Specific Class Body

 
Ranch Hand
Posts: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try printing out the value of CoffeeSize.OVERWHELMING.getLidCode().
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 603
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic