title: Default Classes imported in java
body: <p>I have a simple code:</p>
  
  <pre><code>public class Hello
  {
      public static void main(String[] args)
      {
          System.out.println("Hello World");
      }
  }
  </code></pre>
  
  <p>I know that <code>Object</code> class is imported by default in every java program, but I wanted to ask whether <code>PrintStream</code> class is also imported by default if we are using <code>print()</code> or <code>println()</code> functions?</p>
  
  <p>Because <code>Object</code> class belongs to <code>java.lang</code> package and <code>PrintStream</code> class belongs to <code>java.io</code> package, so if it is not imported by default, then how we are able to use the <code>println()</code> method of <code>PrintStream</code> class?</p>
  
  <p>If it (<code>PrintStream</code> class) is not imported by default, then why the decompiler is importing it?</p>
  
  <p>This is the output after decompiling it:
  <a href="https://i.stack.imgur.com/iIajf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iIajf.png" alt="Check this image"></a></p>