I am getting a error when i am using a throw clause with the method demo()
.And i want to know that what are the limitations of using throws in inheritance.
The error is: Exception ClassNotFoundException
is not compatible with throws clause in Test.demo()
.
Class Test
{
public void demo() throws NumberFormatException, ArrayIndexOutOfBoundsException//error
{
//something here
}
public void demo(String s)
{
//something here
}
}//end of Test class
public class MyTest extends Test
{
public void demo() throws IndexOutOfBoundsException,ClassNotFoundException
{
//something here
}
public static void main(String[] args)
{
}
}