title: Why does the JVM allow us to name a function starting with a digit in bytecode?
body: <p>Identifiers  are well defined by <em>The Java Language Specification, Java SE 7 Edition</em> (§3.8)</p>
  
  <blockquote>
  <pre><code>An identifier is an unlimited-length sequence of Java letters and Java digits, the
  first of which must be a Java letter.
  </code></pre>
  </blockquote>
  
  <p>As far as I know, since a method name is an identifier, It should be impossible to name a method starting with a digit in java, and <code>javac</code> respects this rule.</p>
  
  <p>So, why does the Java Virtual Machine seem to not respect this rule by allowing us to name a function starting with numbers, in Bytecode?</p>
  
  <hr>
  
  <p>This simple snippet will actually print the <code>f99()</code> method name and the value of its parameter.</p>
  
  <pre><code>public class Test {
      public static void main(String[] args) {
          Test t = new Test();
          System.out.println(t.f99(100));
      }
  
      public int f99(int i){
          System.out.println(Thread.currentThread().getStackTrace()[1].getMethodName());
          return i;
      }
  }
  </code></pre>
  
  <p>Compilation and execution:</p>
  
  <pre><code>$ javac Test.java
  $ java Test
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>f99
  100
  </code></pre>
  
  <p>It is possible to disassemble the code once compiled, and rename all <code>f99</code> occurences by <code>99</code> (with the help of a tool like  <a href="http://rejava.sourceforge.net/" rel="noreferrer">reJ</a>).</p>
  
  <pre><code>$ java Test
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>99
  100
  </code></pre>
  
  <p>So, is the name of the method actually "99"?</p>