1// Copyright 2007 The Android Open Source Project
2
3/**
4 * Make sure private methods don't inherit.
5 */
6public class Main {
7    public static void main(String args[]) {
8        PrivatePackage inst1 = new PrivatePackage();
9        PrivatePackage inst2 = new PrivatePackageSub();
10        PrivatePackageSub inst3 = new PrivatePackageSub();
11
12        System.out.println("PrivatePackage --> " + inst1.getStr());
13        System.out.println("PrivatePackage --> " + inst2.getStr());
14        System.out.println("PrivatePackage --> " + inst3.getStr());
15        System.out.println("PrivatePackageSub --> " + inst3.getStrSub());
16
17        inst1.stretchTest();
18    }
19}
20
21class PrivatePackage {
22    public String getStr() {
23        return privGetStr();
24    }
25
26    private String privGetStr() {
27        return "PrivatePackage!";
28    }
29
30    public void stretchTest() {
31        PrivatePackage inst = new PrivatePackageSub();
32        System.out.println("PrivatePackage --> " + inst.getStr());
33        System.out.println("PrivatePackage --> " + inst.privGetStr());
34    }
35}
36
37class PrivatePackageSub extends PrivatePackage {
38    public String getStrSub() {
39        return privGetStr();
40    }
41
42    private String privGetStr() {
43        return "PrivatePackageSub!";
44    }
45}
46
47