Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class D extends C {
  2. void x() {
  3. System.out.println(1);
  4. }
  5.  
  6. }
  7. class C extends B {
  8. void x() {
  9. System.out.println(2);
  10. }
  11.  
  12. }
  13. class B {
  14. void x() {
  15. System.out.println(3);
  16. }
  17. void y(B b) {
  18. b.x();
  19.  
  20. }
  21. void y(C c) {
  22. c.x();
  23.  
  24. }
  25. void y(D d) {
  26. d.x();
  27.  
  28. }
  29.  
  30. }
  31. class A {
  32. public static void main(String[] args) {
  33. new B().y(new C());
  34.  
  35. }
  36.  
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement