class TestFields {

    public static void main(String[] args) {
        System.out.println("Creating Super object");
        Super sp = new Super();
        System.out.println("\nCreating Sub object");
        Sub   sb = new Sub();
        
        System.out.println("\nCreating a Super objref and pointing it to Sub obj");
        Super sp1 = sb;
        sp1.test();
        
        System.out.println("sp1.i " + sp1.i);
    }
}

class Super {
    int i = 10;
    
    Super() {
        System.out.println("Field in Super: " + i);
        test();
    }
    
    void test() {
        System.out.println("test() in Super uses i: " + i);
    }
}

class Sub extends Super {
    float i = 20.0f;
    
    Sub() {
        System.out.println("Field in Sub: " + i);
    }
    
    void test() {
        System.out.println("test() in Sub uses i: " + i);
    }

}
