RuntimeException can be thrown anything because that is an unchecked exception and Unchecked Exceptions need not be declared or caught
the difference between checked and unchecked exceptions:
Checked : Compiler checks whether the exceptions thrown are caught in the program somewhere or not
Unchecked: Compiler does not check the exceptions are caught somewhere or not, means they occur at runtime , like ArrayIndexOutOfBoundsException
SCJP 6 [86%] June 30th, 2010
OCPWCD [84%] March 26th, 2012
OCEJPAD [83%] September 6th, 2014
If you find any post useful, click the "plus one" sign on the right
Ioan Damian Sirbu
Joined: Dec 22, 2008
Thank you, I suspected it but I was not sure.
So basically, adding an unchecked exception in a method's declaration has absolutely no effect.