class A
{
void y()
{ }
void x() throws InterruptedException
{ }
class throwsexample2 extends A
{
void y()
{
x();// compilation error
}
}
}
A)
y() method is a overriding method. So, y() can’t have interrupted exception in its Throws class. Therefore, only option is place x() method call in try block and write corresponding catch block.
Comments
Post a Comment