title: Why don't I have to import some classes?
body: <p>Look at this <code>.java</code> file:</p>
  
  <pre><code>class A {
      HashMap a;
  }
  </code></pre>
  
  <p>It doesn't compile; I need to <code>import java.util.HashMap;</code>. Now consider this one:</p>
  
  <pre><code>class A {
      String a;
  }
  </code></pre>
  
  <p>It's exactly the same—except with <code>String</code> instead of <code>HashMap</code>—so it shouldn't compile, right? Wrong.</p>
  
  <p>Okay, so it's pretty well-known that you don't have to import <code>String</code>, but <em>why</em> is that? The "obvious" answer is because <code>String</code> is used far more often than <code>HashMap</code>, but then shouldn't <code>ArrayList</code> be "implicitly imported"? What about the the primitive wrapper classes, e.g. <code>Integer</code> and <code>Boolean</code>? <code>ArrayList</code> is used <em>far</em> more often than <code>Long</code> and <code>Float</code>, but I have to import <code>ArrayList</code> and don't need to import <code>Float</code>.</p>
  
  <p>What is the reason behind not needing to import <code>String</code>, <code>Integer</code>, <code>Character</code>, <code>Exception</code> and a few other classes?</p>