program will work fine Example:-
/*
* OverSuper.java
*
*Created on May 22, 2006, 12:11 PM
*Concept: overriden method can throw diffrent exceptions
*its method will be overriden in Overriding.
*/
package concepts;
import java.io.*;
/**
*
* @author Abdul
*/
public class OverSuper {
protected void myFunction() throws IOException{
System.out.println("Method in super class throwing IOExcption");
}
}
####################################################
/*
* Overriding.java
*
* Created on May 22, 2006, 12:10 PM
*
* this class overrides a method of super class and try to throw differnt type of excption
*
*/
package concepts;
import java.io.*;
/**
*
* @author Abdul
*/
public class Overriding extends OverSuper{
public Overriding() {
}
protected void myFunction() throws ArithmeticException{
System.out.println("this is ovverriden in sub class throws arithmetic exception");
}
public static void main(String[] arg){
Overriding ov=new Overriding();
ov.myFunction();
}
}