public static void main(String[] args) {
try {
new TestService().testService();
} catch (Exception e) {
// The Exception is used directly in try .. catch here,
// and in fact there will never be a Exception (compiled exception).
// there should be a warning here.
}
}
public void testService() {
// This method does not throw an Exception (compilation type exception)
throw new IllegalArgumentException("IllegalArgument")
}
In short, runtime exceptions should be used when there is no compiled exception