Guest User

Untitled

a guest
Jul 18th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. public class B {
  2.  
  3. private static boolean goo=true;
  4.  
  5. protected static boolean foo() {
  6. goo=!goo;
  7. return goo;
  8. }
  9.  
  10. public String bar="Base:"+foo();
  11.  
  12. public static void main(String[] args) {
  13. B base=new A();
  14. System.out.println("Base:"+goo);//***prints Base:true***
  15. }
  16. }
  17.  
  18. public class A extends B{
  19. public String bar="Sub:"+foo();
  20. }
Add Comment
Please, Sign In to add comment