daily pastebin goal
7%
SHARE
TWEET

Untitled

a guest Feb 13th, 2018 55 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top