I have written a java code which is giving me StackOverflowError:- Here in commented portion I tried catching an exception but wasn't able to handle it.When can we handle StackOverflowError and StackOverflowException?
public class TestExceptions{
public static void main(String [] arg){
try{
new TestExceptions().go();
}catch(Error r){System.out.println("Error is caught:-"+r);}
/*try{
new TestExceptions().go();
}catch(Exception e){System.out.println("Exception is caught here:-"+e);}*/
}
void go(){
System.out.println("Go method is called:-");
go();
}
}