This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes from Enum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "from Enum" Watch "from Enum" New topic
Author

from Enum

Nishant Arora
Greenhorn

Joined: Apr 21, 2009
Posts: 16
I have a class as
enum CheckEnum{ } i have compiled it.
then i disassembled it using javap command , i got

final class CheckEnum extends java.lang.Enum{
--------------------;
--------------------;
static{ };
}

Can anyone explain in detail why this static dispalyed here?
thanks.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

I decompiled that class using JAD, and this is the output:
I can match valueOf and values, so that static block probably matches the creation of the array.

As for the confirmation, I added one single enum value, and JAD now produces this:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
GeeCON Prague 2014
 
subject: from Enum