aspose file tools*
The moose likes Java in General and the fly likes accessing methods using enum Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "accessing methods using enum" Watch "accessing methods using enum" New topic
Author

accessing methods using enum

Chandra shekar M
Ranch Hand

Joined: Dec 20, 2006
Posts: 135
Hi All,



Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

In #1 you're defining a method in the SingleTone class, so it's accessible through any reference to a SingleTone.

In #2 and #3, hi() is not defined in SingleTone, but rather in anonymous inner classes (Or something roughly equivalent to them. I forget the details of how that works out in enums.)

If you want #2 and #3 to work, you have to do it something like this:


 
jQuery in Action, 2nd edition
 
subject: accessing methods using enum