title: In Java, the variable name can be same with the classname
body: <p>In Java I can declare a variable, whose name is total same with its classname. I think it is a so confusing and strange design.</p>
  
  <p>So I have a problem in the code snippet below: how can the compiler distinguish the <code>ClassName</code>, it is referenced the <strong>variable</strong> name or <strong>class</strong> name? </p>
  
  <p>In the running result, the compiler references <code>ClassName</code> as a variable name.</p>
  
  <pre><code>class ClassName{}
  
  public class Test {
      public static void main(String[] args){
          ClassName ClassName = new ClassName();
          System.out.println(ClassName); //ClassName@18fb53f6
      }
  }
  </code></pre>