title: What is the use/purpose of primitive type classes?
body: <p>I recently learned that there are <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Class.html">Class</a> representations for the primitive types in the JVM.  For example, <code>int.class</code>, <code>double.class</code>, and even a <code>void.class</code>.</p>
  
  <p>What I don't understand is <em>why</em> these are there.  They don't seem to serve any functional role.  Using reflection, I searched through the classes, and they have no constructors, no methods, and no fields.  For all intents and purposes, they seem empty and useless.  The primitive type variables are not even instances of their respective classes, as indicated by the following returning false:</p>
  
  <pre><code>int a = 3;
  int.class.isInstance(a);
  </code></pre>
  
  <p>So why do they exist?  They must serve some purpose, maybe for the compiler or something, but whatever it is is completely beyond me.  There is even an explicit reference to <code>int.class</code> in the <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Integer.html#TYPE">Integer API</a> (and likewise for each primitive type and its respective wrapper Object).  I haven't been able to find any reference to their existence, much less their use, in the JLS.</p>