why should we declare checked exceptions?
Hi !My doubt is on checked,unchecked exceptions in java.
1)You know that if there is any possibility for checked exception to be thrown from a method and we do not have intention to handle the thrown exception then we have to declare that exception in method header.That means we have to write “throws EXCEPTION NAME” in method header.
2)But in case of unchecked exception, if there is any possibility for unchecked exception to be thrown from a method then we do not declare that exception in method header.. That means we do not write “throws EXCEPTION NAME” in method header .
3)Why should we declare the exception in method header in case of checked exceptions ? what benefits are we getting by declaring exception in method header?
4)Why do not we declare the exception in method header in case of unchecked exceptions?