Question: Java)The finally block introduces complications in the Java language specification. Write a program to determine what value is returned by foo and what exception is
Java)The finally block introduces complications in the Java language specification. Write a program to determine what value is returned by foo and what exception is thrown by bar in the code below.
public static void foo( )
{ try
{ return 0;
}finally { return 1;
}}
public static void bar( )
{ try
{ throw new NullPointerException( );
}finally {
throw new ArithmeticException( ); }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
