File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes two class files for one java file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "two class files for one java file" Watch "two class files for one java file" New topic
Author

two class files for one java file

feroz muhamed
Ranch Hand

Joined: Nov 15, 2003
Posts: 87
hi,
please look at this.when i am compiling java file which importing awt package and extends any awt components, two class files one with original claas name and other with classname$1 like this. how this happens please help.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
The other one is probably generated because you have an annonymous inner class in the original class, and the compiler gererates an articficial name for it.


"JavaRanch, where the deer and the Certified play" - David O'Meara
feroz muhamed
Ranch Hand

Joined: Nov 15, 2003
Posts: 87
thanks cindy really only now i identified this.if u know the naming criteria for this(ie sometimes myclass$mybuuton,or myclass$B like that)please...
Peter Kleczka
Greenhorn

Joined: Feb 09, 2003
Posts: 18
Member classes are written to a file of the form EnclosingClass$MemberClass.class
Anonymous inner clases are written in the form
EnclisingClass$1.class and are numbered sequentially
for multiple anonymous classes.
When anonymous inner classes appear inside of other
anonymous inner classes, the pattern is Outer$1.class
not Outer$Inner$1.class.
HTH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: two class files for one java file