I have the following code
public static void nocatch()
{
    try
    {
        throw new Exception();
    }
    finally
    {
    }
}
Which gives the error
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
Unhandled exception type CustomException
Which is as expected, but adding a return statement in the finally block makes the error go away
public static void nocatch()
{
    try
    {
        throw new Exception();
    }
    finally
    {
        return; //makes the error go away! 
    }
}
Can someone please explain me what is going on? and why the error disappears?
Note : I wrote this code purely for experimental purposes!
 
     
    