title: Can we catch an Error in Java?
body: <p>If you run following code then it will compile and run successfully,</p>
  
  <pre><code>public class Example {
      public static void main(String[] args) {
          // insert code here
          try {
              new Example().go();
              // throw new OutOfMemoryError();
          } catch (Error e) {
              System.out.println(e);
          }
      }
  
      void go() {
          go();
      }
  }
  </code></pre>
  
  <p>With following output :</p>
  
  <pre><code>java.lang.StackOverflowError
  </code></pre>
  
  <p>So my question is <strong>"Can we catch an Error"</strong>..??</p>