when i run the program below it gives compiler error saying that myref.test() does not throw exception.but as i know it is not necessary that the code should throw the exception
import java.io.*;
public class TechnoSample {
public static void main(
String[] args) {
TechnoSampleSub myref = new TechnoSampleSub();
try{
myref.test();
}catch(IOException ioe){}
}
void
test() throws IOException{
System.out.println("In TechnoSample");
throw new IOException();
}
}
class TechnoSampleSub extends TechnoSample {
void test() {
System.out.println("In TechnoSampleSub");
}
}