title: Java's System.exit(0); vs C++ return 0;
body: <p>When we learn C++ in school, our professor will tell us to write <code>return 0;</code> at the last line of codes in the main function and it is considered as a good programming practice.</p>
  
  <p>In Java, I realise some people writes <code>System.exit(0);</code> at the last line of the main method.</p>
  
  <p>However, in C++, if I use <code>exit(0);</code> I get penalized by my professor, because (in school) for procedural programming, we are expected to let the program flow till the end of main and let the program stop naturally.</p>
  
  <p><strong>My question</strong>: Is Java's <code>System.exit(0);</code> similar to C++'s <code>return 0;</code> ? (Or is it similar to C++'s <code>exit(0)</code>) </p>
  
  <p>Is it bad practice to use <code>System.exit(0)</code> in java when it is unnecessary (I.e.: writing it in last line of main method)?</p>