chavdardim1990

Untitled

Dec 4th, 2023
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. public class Main {
  2.  
  3. public static void main(String[] args) {
  4. Bar bar = new Bar();
  5. bar.doSomething();
  6. }
  7. }
  8.  
  9. class Foo {
  10. public Foo() {
  11. doSomething();
  12. }
  13.  
  14. public void doSomething() {
  15. System.out.println("Do something important!");
  16. }
  17. }
  18.  
  19. class Bar extends Foo {
  20. public void doSomething() {
  21. System.out.println("YOLO!");
  22. Zoom zoom = new Zoom(this);
  23. }
  24. }
  25.  
  26. class Zoom {
  27. public Zoom(Bar bar) {
  28. bar.doSomething();
  29. }
  30. }
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment