This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 41085
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: 37950
That is normal. You get classes called MyClass$1 or similar whenever you have an anonymous class.
Rob Spoor

Joined: Oct 27, 2005
Posts: 19651

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?