SE450: Overriding: Class fields [20/35] |
Class fields [source] [doc-public] [doc-private]
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
package subclass.ex5; public class M { public static void main(String[] argv) { (new B()).m(); } } class A { static void p() { System.out.println("A.p: " + x); // which x? } static final int x = 42; } @SuppressWarnings("all") class B extends A { void m() { this.p(); System.out.println("B.m: " + x); // which x? } static final int x = 27; }