Private02.java revision 2839:592d64800143
1/*
2 * @test   /nodynamiccopyright/
3 * @bug    8071453
4 * @author sadayapalam
5 * @summary Various tests for private methods in interfaces.
6 * @compile/fail/ref=Private02.out -XDrawDiagnostics Private02.java
7 */
8
9
10public class Private02 {
11    interface I {
12        private void foo(String s); // Error: private method must declare body.
13        private abstract void foo(int i, int j); // Error: private & abstract: bad combo
14        void foo(int x); // OK.
15        private I foo() { return null; } // OK.
16        private void foo(int x) {} // Name clash.
17    }
18    interface J extends I {
19        private J foo() { return null; } // OK.
20    }
21    interface K extends J {
22        void foo(); // OK
23    }
24}
25