daily pastebin goal
43%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class A {
  2.     public void method() {return 'A'}
  3. }
  4. class B extends A {
  5.     public void method() {return 'B'}
  6. }
  7.  
  8. A bla = new B();
  9. A blabla = new A();
  10.  
  11. System.out.println(blabla.method()); //выведет A
  12. System.out.println(bla.method()); //выведет B
  13.  
  14. B bla1 = new B(); //норм
  15. B bla2 = new A(); //ошибка
RAW Paste Data
Top