Search code examples
javabytecode

The naming of Java Class file


I'm learning about the Java Class files. I know that when a Java source file(Source.java) get compiled, we get Source.class file. If this Source.java contains some inner interface, we will get Source.class and Source$inner-interface.class. This is understandable as explained in this link:

http://javarevisited.blogspot.com/2012/05/10-points-about-class-file-in-java.html

However, what confuses me is that sometimes I get more than that:

Source$1.class

Source$1$1.class

Source$1$2.class

Source$inner-interface.class

Where do these Source$1.class, Source$1$1.class and Source$1$2.class come from? What do these $1, $1$1, $1$2 mean? Do they have anything to do with the static variable inside the source file?

Thanks!


Solution

  • Those are the anonymous inner classes defined inside the main class.