aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes enum methods Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "enum methods" Watch "enum methods" New topic
Author

enum methods

Jack Bento
Ranch Hand

Joined: Jun 14, 2009
Posts: 34
Hi

Please help me understand the difference between these 2 methods. How would I call them? Why is the first one enclosed in curlys?

Thanks!

Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

are you able to compile this code?


SCJP6 96% | SCWCD5 81% | SCDJWS5 79%
Costi Ciudatu
Ranch Hand

Joined: Oct 24, 2006
Posts: 74
First, let me try to make your code compilable (and a little more relevant):



SCARY overrides the spice() method, that's why it is declared inline (in curlys).
'new' is not suitable for enums in general (not to mention that is syntactically wrong.
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400


the above code you can compile and run successfully.
Jack Bento
Ranch Hand

Joined: Jun 14, 2009
Posts: 34


does not compile?
Jack Bento
Ranch Hand

Joined: Jun 14, 2009
Posts: 34
Sorry I get it now. The first method belongs to scary. Thanks for helping me.
Minhaj Mehmood
Ranch Hand

Joined: Jan 22, 2007
Posts: 400

Jack Bento wrote:

does not compile?


dint get you??
 
Consider Paul's rocket mass heater.
 
subject: enum methods
 
Similar Threads
ENUM'S
enum: can anyone post the rules for enum declarations
deviation in the return type of getParameterValues() method
generic enum and the values() method