Java compiler uses "$" symbol internally to decorate certain names.
For Example:
public class demo {
class test {
public int x;
}
public void myTrial () {
Object obj = new Object () {
public String toString() {
return "hello world!";
}
};
}
}
Compiling this program will produce three .class files:
- demo.class, containing the main (outer) class demo
- demo$test.class, containing the named inner class demo.test
- demo$1.class, containing the anonymous inner class (local to method demo.myTrial)
The javac uses $ in some automatically-generated variable names for the implicitly referencing from the inner classes to their outer classes.