Why here I've got only RuntimeException("in finally")
but no NullpointerException("in catch")
?
And if I comment // throw new NullPointerException("in finally");
in finally
block why I would get NullPointerException("in catch")
? What's going on here?
public class Solution
{
public static void main(String[] args)
{
try
{
throw new ArithmeticException();
}
catch (ArithmeticException e)
{
throw new NullPointerException("in catch");
}
finally
{
throw new RuntimeException("in finally");
}
}
}