Should a checked exception be handled before the completion of the code?
As we know, the checked exceptions can be handled(try catch) or declared(throws).
For egs,
Class A{
public static void main(
String[] args)
{
try{ m1();
}
catch(Exception e){ }
}
void m1() throws Exception{
m2();
}
void m2() throws Exception{
throw new Exception();
}
}
In this egs, I have handled the Exception in the main method.
If I m not handling, Is it possible throw the Exception in the main method???
public static void main(String[] args)
throws Exception
{
m1();
}