Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class A {
- void callme() {System.out.print("A");}
- }
- public class B extends A{
- void callme() {System.out.print("B");}
- }
- public class C extends B{
- void callme() {System.out.print("C");}
- }
- public class Extender {
- public static void main(String[] args) {
- A a = new A();
- B b = new B();
- C c = new C();
- A r = a;
- r.callme();
- r = b;
- r.callme();
- r = c;
- r.callme();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement