I have searched for some answers , but could not find & hence I am raising this as a new question. The catch method in the try-catch. Is it a method ? , Its taking an object of type Exception as an argument. But if its a method ,
Who calls this method and by which object this method is called ?
You cannot write a method definition inside another method definition normally.So if its a method , how am I able to write the catch inside another method ?
If its not a method , then what is it ?
public void foo() { try { ; } catch (Exception ex) { ; // this is catch method body } }
The above code means catch method body is inside another method foo()'s body.