import java.io.IOException;
public class ExceptionTest{
public static void main (
String[]args)
{
try {
methodA();
}
catch (Exception e) //compilation error here
{
system.out.println("Caught Exception");
}
}
public static void methodA () throws IOException{
throw new IOException ();
}
}
why the above code gives compilation error at catch(Exception) line?
I thought that we can put catch(Exception e) for any exception
message is:Type mismatch cannot convert from Exception to Throwable