File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Argument-Defined Anonymous Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Argument-Defined Anonymous Inner Class" Watch "Argument-Defined Anonymous Inner Class" New topic

Argument-Defined Anonymous Inner Class

Nitin Kulkarni

Joined: Aug 13, 2004
Posts: 7

I have a question on the following code

This program outputs "doStuff"
Is there any way that I could get "fluffy" to print out?
I do not know how to access this method that is inside the
Argument-Defined Anonymous Inner Class.

[ August 25, 2004: Message edited by: Nitin Kulkarni ]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Since the method doStuff contains the reference to the Foo type object, you can invoke methods of Foo from the doStuff method context.

Is there any way that I could get "fluffy" to print out?

Yes. Change what doStuff does with its Foo reference.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Argument-Defined Anonymous Inner Class
It's not a secret anymore!