The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes enum methods Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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??
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: enum methods
 
Similar Threads
enum: can anyone post the rules for enum declarations
generic enum and the values() method
deviation in the return type of getParameterValues() method
ENUM'S