Wednesday, 12 April 2017

q-15 What is output of the following program?
class ReturnValue
{
    public static void main(String[] args)
    {
        System.out.println(methodReturningValue());
    }

    static int methodReturningValue()
    {
        try
        {
            return 49;
        }
        catch (Exception e)
        {
            return 20;
        }
        finally
        {
              System.out.println("finally block");
         }
    }
}


a)Compilation fails b)runtime exception c)20 finally block    d)49 finally block



No comments:

Post a Comment