You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DefaultMethod.java 525B

12345678910111213141516171819
  1. package test5;
  2. interface DefaultMethodSupIntf {
  3. default int foo() { return 0; }
  4. }
  5. interface DefaultMethodIntf extends DefaultMethodSupIntf {
  6. default int foo() { return 1; }
  7. static int baz() { return 10; }
  8. }
  9. public class DefaultMethod implements DefaultMethodIntf {
  10. public int bar() { return DefaultMethodIntf.super.foo(); }
  11. public static void main(String[] args) {
  12. int i = new DefaultMethod().bar() + new DefaultMethod().foo() + DefaultMethodIntf.baz();
  13. System.out.println(i);
  14. }
  15. }