Skip to main content

Inner class file?

1 reply [Last post]
emjayes
Offline
Joined: 2007-12-03
Points: 0

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 Main.java, which is among the files. And when I run:

javap -c -l Main$ForecastSales

The output generated starts with:

"Compiled from "Main.java"
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 Main.java.

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.
martinoc
Offline
Joined: 2006-05-05
Points: 0

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.