diff options
Diffstat (limited to 'src/test/test5')
-rw-r--r-- | src/test/test5/DefaultMethod.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/test/test5/DefaultMethod.java b/src/test/test5/DefaultMethod.java new file mode 100644 index 00000000..7cabb1f3 --- /dev/null +++ b/src/test/test5/DefaultMethod.java @@ -0,0 +1,19 @@ +package test5; + +interface DefaultMethodSupIntf { + default int foo() { return 0; } +} + +interface DefaultMethodIntf extends DefaultMethodSupIntf { + default int foo() { return 1; } + static int baz() { return 10; } +} + +public class DefaultMethod implements DefaultMethodIntf { + public int bar() { return DefaultMethodIntf.super.foo(); } + + public static void main(String[] args) { + int i = new DefaultMethod().bar() + new DefaultMethod().foo() + DefaultMethodIntf.baz(); + System.out.println(i); + } +} |