class TestLateBinding {

    public static void main(String[] args){
        LB_1 lb1 = new LB_1();
        LB_2 lb2 = new LB_2();
        
        LB_1 lb3 = lb2;
        
        System.out.println("LB_1 called with 10: " + lb1.retValue(10));
        System.out.println("LB_1 called with 'Hello': " + lb1.retValue("Hello"));        
        System.out.println("LB_2 called with 20: " + lb2.retValue(20));
        System.out.println("LB_2 called with 'Bye', 30: " + lb2.retValue("Bye",30));  
        System.out.println("LB_3 called with 'Today': " + lb3.retValue("Today"));          
                      
    }
}

class LB_1 {

    public int retValue(int i) {
        return i;
    }
    
    public String retValue(String s) {
        return "In LB_1 with " + s;
    }
    
    public void testEx() throws LBException {
        throw new LBException();
    }        
    
}

class LB_2 extends LB_1 {

    public String retValue(String s) {
        return "In LB_2 with " + s;
    }

    public String retValue(String s, int i) {
        return "Value from LB_2 " + i;
    }
    
    public void testEX() throws LBException1{
        throw new LBException1();
    }
}

class LBException extends Exception{}
class LBException1 extends LBException {}
