[Solved] Unable to throw Exception, why? [closed]


We can throw Exception, provided we declare the method to throw the same Exception (throws Exception clause) or handle it (using try catch block) .

Exception is a checked exception and these have to be handled

but

RuntimeException works because its unchecked Exception and for this we need not have a throws clause or handle it

See Checked vs Unchecked Exception

3

solved Unable to throw Exception, why? [closed]