aspose file tools*
The moose likes Beginning Java and the fly likes Internal Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Internal Class" Watch "Internal Class" New topic

Internal Class

Ron Boles

Joined: Feb 24, 2002
Posts: 3
Hi folks.. JAVA noooob here !!

When I compile my applet which contains an internal FileFilter class, javac appears to generate two .class files!

Is it possible to direct the compiler to somehow include the internal FileFilter class into the applet class file ??

Thanks a million in advance.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42277
Yes, that's an anonymous inner class. I'll move this to a different forum, as it has nothing to do with applets.

Ping & DNS - my free Android networking tools app
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 39409
That is normal. You get classes called MyClass$1 or similar whenever you have an anonymous class.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19720

Every class will have its own .class file, even anonymous classes. So if you want to have only one class file, you must make sure you only have one class. If you turn your applet into a FileFilter as well (by adding "implements FileFilter") you can do this, but please note that it is bad design.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Internal Class