Advertisement
JeffGrigg

Untitled

Feb 21st, 2021
1,955
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.32 KB | None | 0 0
  1. public class A {
  2.     static int a = 10;
  3.     static {
  4.         System.out.println("Hi");
  5.     }
  6. }
  7.  
  8. public class B extends A {
  9.     static int b = 20;
  10.     static {
  11.         System.out.println("Hello");
  12.     }
  13. }
  14.  
  15. public class Test {
  16.     public static void main(String[] args) {
  17.         System.out.println(B.a);
  18.     }
  19. }
  20.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement