title: Variables having same name but different type
body: <p>I have read <a href="http://www.steike.com/code/java-reverse-engineering" rel="nofollow noreferrer">here</a> that in Java it is possible for two variables having same name but different type to co-exist in the same scope. What I mean is this</p>
  <pre><code>class test
  {
      private int x;
      private double x;
  }
  </code></pre>
  <p>But all java IDE do not allow such code. I want to know whether such a code is really syntactically correct, or simply the IDE do not allow such code to prevent ambiguity.</p>
  <p>Anyway here is the extract from the <a href="http://www.steike.com/code/java-reverse-engineering/" rel="nofollow noreferrer">website</a></p>
  <blockquote>
  <p>&quot;If you're lucky, you might be able to recompile the output from Jad. <strong>However, the Java VM has more lenient rules for variable naming than the Java language itself. For instances, a valid class file can have several variables named 'a', as long as they have different types. If you decompile such a class, the source code you get will not be valid.</strong></p>
  <p>JAD will usually rename the offending fields, and make a recompilable file... the only problem being that the recompiled file won't be compatible with the original classes.&quot;</p>
  </blockquote>