Fri, 24 Apr 2020 03:58:51 +0100
Merge
duke@1 | 1 | /* |
duke@1 | 2 | * @test /nodynamiccopyright/ |
duke@1 | 3 | * @bug 5003235 |
duke@1 | 4 | * @summary Accessibility of private inner class |
duke@1 | 5 | * @author Peter von der Ah\u00e9 |
jjg@611 | 6 | * @compile/fail/ref=T5003235b.out -XDdiags=%b:%l:%_%m T5003235b.java |
duke@1 | 7 | */ |
duke@1 | 8 | |
duke@1 | 9 | class Outer { |
duke@1 | 10 | public Inner inner; |
duke@1 | 11 | |
duke@1 | 12 | public void create() { |
duke@1 | 13 | inner = new Inner(); |
duke@1 | 14 | } |
duke@1 | 15 | |
duke@1 | 16 | private class Inner { |
duke@1 | 17 | int k = 100; |
duke@1 | 18 | protected int l = 100; |
duke@1 | 19 | public int m = 100; |
duke@1 | 20 | protected int n = 100; |
duke@1 | 21 | } |
duke@1 | 22 | } |
duke@1 | 23 | |
duke@1 | 24 | class Access { |
duke@1 | 25 | public static void main(String[] args) { |
duke@1 | 26 | Outer outer = new Outer(); |
duke@1 | 27 | outer.create(); |
duke@1 | 28 | System.out.println("Value of k: " + outer.inner.k); |
duke@1 | 29 | System.out.println("Value of l: " + outer.inner.l); |
duke@1 | 30 | System.out.println("Value of m: " + outer.inner.m); |
duke@1 | 31 | System.out.println("Value of n: " + outer.inner.n); |
duke@1 | 32 | } |
duke@1 | 33 | } |