Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jdavidb (1361)

  (email not shown publicly)

J. David Blackstone has a Bachelor of Science in Computer Science and Engineering and nine years of experience at a wireless telecommunications company, where he learned Perl and never looked back. J. David has an advantage in that he works really hard, he has a passion for writing good software, and he knows many of the world's best Perl programmers.

Journal of jdavidb (1361)

Monday February 11, 2008
10:04 AM

Java gem of the day: throw exceptions from main()

[ #35630 ]

So you're writing a quick main() method to test something (yes, I know you should be writing unit tests; I should, too), and the method you're testing throws exceptions. Don't write exception handling code. Let your calling environment (most likely the JVM) handle the exceptions: declare that your main() method just throws those exceptions. It won't make your main() method uncallable or unfindable by the JVM, and whatever your environment does in response will probably be at least as useful as whatever you would've written, such as printing a stack trace.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.