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
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: 42601
    
  65
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
Sheriff

Joined: Oct 13, 2005
Posts: 39814
    
  28
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: 19760
    
  20

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Internal Class