File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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 EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Internal Class" Watch "Internal Class" New topic
Author

Internal Class

Ron Boles
Greenhorn

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
Marshal

Joined: Mar 22, 2005
Posts: 39529
    
  27
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
Sheriff

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

Joined: Oct 27, 2005
Posts: 19538
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internal Class
 
Similar Threads
JFileChooser!
Is it possible to write a reg exp to search for files?
How do I get dir.list() to ignore directories
JFileChooser csv only and default directory
Doubt in a method of File class