Generally RuntimeExceptions are exceptions that can be prevented programmatically. E.g
EDIT : These days people favor
NullPointerException, ArrayIndexOutOfBoundException. If you check for null before calling any method, NullPointerException would never occur. Similarly ArrayIndexOutOfBoundException would never occur if you check the index first. RuntimeException are not checked by the compiler, so it is clean code.EDIT : These days people favor
RuntimeException because the clean code it produces. It is totally a personal choice.
No comments:
Post a Comment