I would like to know why I got like 30 ClassFiles in the “bin” folder for my Program.java program.
They are named as followed:
Testworks$1.class
Testworks$2.class
Testworks$3.class
Testworks$4.class
...
and there is one Testworks.class
When I generate my Program.jar file all 30 Testworks$X.class are copied inside.
Do I really need them and how can I exclude them?
These classes are anonymous inner classes. If you have used GUI programming,you might have noticed them. When you create listeners for events, you might do something like:-
This inner class has no explicit name, hence the compiler names it using the convention OuterClass$x.class. x is replaced by the number of inner class (for eg, 1, 2..etc)