title: Java - how does it load and find the right method
body: <p>I am trying to understand how Java selects the right method and how it works internally.</p>
  
  <p>Say I have two functions:</p>
  
  <pre><code>public void print(int i) { System.out.println("int: " + i); }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public void print(String s) { System.out.println("String: " + s); }
  </code></pre>
  
  <p>How does Java actually </p>
  
  <ol>
  <li>Store all of the accessible classes and methods?</li>
  <li>Determine which overloaded method is the right one to use?</li>
  </ol>
  
  <p>I know that as I call methods it puts them on the JVM stack but I'm trying to understand what happens just before that.  How is it all stored and loaded internally?</p>
  
  <p>Thanks!</p>