Published: Nov 08 2013 / 13:13
Using assert instead throwing AssertionError is definitely the right choice. Errors are generally only meant to be thrown by the JVM itself, not by app code. For the default switch case, I generally throw UnsupportedOperationException.
Of course you'd use non of them in real code. Typical blog post problem.
Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.
Advertising - Terms of Service - Privacy - © 1997-2014, DZone, Inc.