View Javadoc
1   package ch.hslu.exercises.sw09;
2   
3   public final class ConstructorCallsOverride {
4       private ConstructorCallsOverride() {
5       }
6   
7       public static void main(final String[] args) {
8   
9           abstract class Base {
10              Base() {
11                  overrideMe();
12              }
13  
14              abstract void overrideMe();
15          }
16  
17          class Child extends Base {
18  
19              private final int x;
20  
21              Child(final int x) {
22                  this.x = x;
23              }
24  
25              @Override
26              void overrideMe() {
27                  System.out.println(x);
28              }
29          }
30          new Child(42); // prints "0"
31      }
32  }