Advertisement
DulcetAirman

Duplicate default methods

Oct 9th, 2015
186
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Duplicate default methods named abc with the parameters () and () are inherited from the types C and B
  2.  
  3. abstract class A {
  4.  
  5. }
  6.  
  7. interface B {
  8.  
  9.     default void abc() {
  10.         System.out.println("Interface B");
  11.     }
  12. }
  13.  
  14. interface C {
  15.  
  16.     default void abc() {
  17.         System.out.println("Interface C");
  18.     }
  19. }
  20.  
  21. public class Test extends A implements B, C {
  22.  
  23.     public static void main(final String[] args) {
  24.         final Test t = new Test();
  25.         t.abc();
  26.     }
  27. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement