Sunday, 19 May 2013

Exception - 6 -



package net.dharmaraj;

public class AQuestion
{
    public static void main(String args[])
    {
        System.out.println("Before Try");
        try
        {
        }
        catch (java.io.IOException t)
        {
            System.out.println("Inside Catch");
        }
        System.out.println("At the End");
    }
}



1) Compiler error complaining about the catch block where no IOException object
can ever be   thrown. 
2) Compiler error - IOException not found. It must be imported in the first line 
of the code.
3)  No compiler error. The lines "Before Try" and "At the end" are printed on the screen. 

No comments:

Post a Comment