我目前的代码:
class ThrowDemo
{
static void throwMethod()
{
System.out.println("Inside throwMethod");
throw new IllegalAccessException("demo");
}
public static void main(String args[])
{
try
{
throwMethod();
}
catch(IllegalAccessException e)
{
System.out.println("Caught"+e);
}
}
}
我必须抓住throwMethod
抛出的知识异常。但是为什么IllegalAccessException
被throwMethod
抛出并未被捕获?