title: Difference between exception handling in C++ and Java?
body: <p>In Java, if a specific line of code causes the program to crash, then the exception is caught and the program continues to execute.</p>
  
  <p>However, in C++, if I have a piece of code that causes the program to crash, like:</p>
  
  <pre><code>try
  {
      int x = 6;
      int *p = NULL;
      p = reinterpret_cast&lt;int*&gt;(x);
  
      *p = 10; // the program crashed here
  
      cout &lt;&lt; "x = " &lt;&lt; *p &lt;&lt; endl;
  }
  catch(const char* Message)
  {
      cout &lt;&lt; "There is an run-time error";
  }
  </code></pre>
  
  <p>Then the program still crash and the exception is not caught.</p>
  
  <p>So what is the point of exception handling in C++? Am I misunderstanding something?</p>