title: java exception handling in inheritance
body: <p>just look at program below..</p>
  
  <pre><code>import java.io.*;
  import java.rmi.*; 
  class class1 
  {
   public void m1() throws RemoteException 
  {
   System.out.println("m1 in class1"); } }
  
   class class2 extends class1 
  {
    public void m1() throws IOException 
  {  
     System.out.println("m1 in class2");
  
  } }
  
  class ExceptionTest2 
   { 
  public static void main(String args[])
   {
     class1 obj = new class1();
    try{ 
  obj.m1(); 
  } catch(RemoteException e){ System.out.println("ioexception"); }
  
  } }
  </code></pre>
  
  <p>compile time error.....can not override m1() method</p>
  
  <p>Now if I replace RemoteException in parent class with IOException and vice versa in child class. Then it is compiling.</p>
  
  <p>Any other checked exception combinations are not working here, evenif I am using checked exception which are at same level.</p>
  
  <p>Now I am confused why overriding is taking place only in one case, not in other cases??? I will realy appreciate your answer. </p>