Why does the cast determine which overloaded method gets called?
<p>If java is pass-by-value, and that value is the memory address for the actual type, then why does the overloaded method that's called get decided by the reference/declared type? </p>

<pre><code>class Boss {

  void test(Object o){
    System.out.println("object"); 
  }

  void test(Boss b){ 
    System.out.println("boss"); 
  }

  public static void main( String[] args ) {
    Boss b = new Boss();
    b.test((Object)b); //prints out object, why?
  }

}
</code></pre>
