This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
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

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "accessing methods using enum" Watch "accessing methods using enum" New topic

accessing methods using enum

Chandra shekar M
Ranch Hand

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

Jeff Verdegan

Joined: Jan 03, 2004
Posts: 6109

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:

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: accessing methods using enum
jQuery in Action, 3rd edition