title: Programmatically determining the compile-type of a java instance
body: <p>Say I have a class that extends java.lang.Object as follows:</p>
  
  <pre><code>package pack;
  
  public class Person {
  
  }
  </code></pre>
  
  <p>And the following three instances:</p>
  
  <pre><code>Object one = new Object();
  Object two = new Person();
  Person three = new Person();
  </code></pre>
  
  <p>In order to determine the <strong>runtime-type</strong>, I just need invoke the <strong>getClass()</strong> method on the instances as follows:</p>
  
  <pre><code>System.out.println("One runtime-type : " + one.getClass());
  System.out.println("Two runtime-type :  " + two.getClass());
  System.out.println("Three runtime-type : " + three.getClass());
  </code></pre>
  
  <p>Which outputs:</p>
  
  <pre><code>One runtime-type : class java.lang.Object
  Two runtime-type :  class pack.Person
  Three runtime-type : class pack.Person
  </code></pre>
  
  <p>Now my question is how do I programmatically determine the <strong>static/compile-type</strong> of the instances above?</p>
  
  <p>By static/compile-type I mean the type "on the left". It <strong>would</strong> output:</p>
  
  <pre><code>One compile-type : class java.lang.Object
  Two compile-type :  class java.lang.Object
  Three compile-type : class pack.Person
  </code></pre>