Java class name containing dollar sign
<p>I've got following Java classes defined:</p>

<pre><code>mac-grek:javajunk grek$ cat A\$B.java
class A$B {}
mac-grek:javajunk grek$ cat A.java
public class A {
  public static class B {}
}
mac-grek:javajunk grek$ cat Main.java 
public class Main {

  public static void main(String[] args) {
    System.out.println(A.B.class.getName());
    System.out.println(A$B.class.getName());
  }

}
</code></pre>

<p>When I try to compile them, I get following errors:</p>

<pre><code>mac-grek:javajunk grek$ javac 'A$B.java' A.java Main.java
A.java:2: duplicate class: A.B
  public static class B {}
                ^
Main.java:4: cannot find symbol
symbol  : class B
location: class A
    System.out.println(A.B.class.getName());
                        ^
Main.java:5: cannot find symbol
symbol  : class A$B
location: class Main
    System.out.println(A$B.class.getName());
                       ^
3 errors
</code></pre>

<p>If I remove <code>A.java</code> file and <code>System.out.println(A.B.class.getName());</code> from <code>Main.java</code> everything compiles:</p>

<pre><code>mac-grek:javajunk grek$ cat A\$B.java 
class A$B {}
mac-grek:javajunk grek$ cat Main.java 
public class Main {

  public static void main(String[] args) {
    System.out.println(A$B.class.getName());
  }

}
mac-grek:javajunk grek$ javac A\$B.java Main.java
mac-grek:javajunk grek$ 
</code></pre>

<p>So Java allows me to define a class containing dollar sign in it's name. How can I compile my original example?</p>
