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 Java 8 in Action this week in the Java 8 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: 39576
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 - updated with new look and Ping home screen widget
Campbell Ritchie

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

Joined: Oct 27, 2005
Posts: 19556

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
Similar Threads
How do I get dir.list() to ignore directories
Doubt in a method of File class
JFileChooser csv only and default directory
Is it possible to write a reg exp to search for files?