Skip to main content

Inner class file?

1 reply [Last post]
Joined: 2007-12-03

Does anyone know if there is any way that a Java compiler ( or any Java IDE ) could have generated what appears to be an inner class file without that inner class having been defined in the original source code? For example, I have a program that has a .class file called Main$ForecastSales among its files. But there is no inner class defined inside the file, which is among the files. And when I run:

javap -c -l Main$ForecastSales

The output generated starts with:

"Compiled from ""
public class Main$ForecastSales extends java.lang.Object"

I could be wrong, but this suggests that there was an inner class called ForecastSales defined, at some point in the program's development, inside

I was wondering if anyone had any other suggestions as to how the Main$ForecastSales.class file could have been generated?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-05-05

There could be an anonymous inner class defined. Without seeing the source its difficult to guess. It is possible to define eg an anonymous implementation of an interface in the parameter block of a method call which accepts the interface type as a parameter.