throw new Exception();
If you put this statement in a method, you should either add throws Exception
after the method name. Or, you can surround the statement with try-catch.
try {
throw new Exception();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
But what is it the point here? The compiler permit it, so I just want to know if it is designed intentionally. I am curious.