While compiling the code of Tic Tac Toe and also while running some codes in java using swing and awt packages. I’m getting a $ appended class file generation, parallel to the ClassName.class file. What may be the reason? Its Whether due to the usage of ActionListeners, it Happens. Usually these kind of creation of .bak file will be generated while doing C programs involving structures.
Support needed regarding these two scenarios.
Class files containing
$in their names are nothing but theinner classesoranonymous inner classesthat you might have used inside your top-level class.For e.g, If you have a class declaration like this: –
Then you will have two class files generated: –
A.classandA$B.class.This shows the containment of
class Binsideclass A.In case of
ActionListenerthis is what is happening, in your code.UPDATE: –
If you are using
anonymous inner class, then also you will get class name with$in it: –Then the class files generated will be: –
Foo.classandFoo$1.class.So, if you are using
ActionListeneras anonymous inner class, then also you would get that$, in yourclass filename for thatanonymous inner class.