Multiple .class files generated for a class?

These are for inner classes and static nested classes. The ones with numbers are anonymous inner classes.

For example:

class Foo {
   class Bar { }
   static class Baz { }
   void run() {
      Helper t = new Helper() {
         int helpMethod() {
            return 2;

This will produce class files Foo.class, Foo$Bar.class, Foo$Baz.class and Foo$1.class (for the implementation of the Helper interface)

Leave a Comment