Useless throwing Exceptions

2020-02-03

Found this code a long time ago:

try {
	if( something == null )
		throw new RuntimeException("...");
} catch(Exception e){
	e.printStackTrace();
}

and I wondered why on earth the try/throw/catch has been used instead of:

if( something == null )
	new RuntimeException("...").printStackTrace();
code-funjava

Boolean to String

Synchronized New Object