Skip to content

Instantly share code, notes, and snippets.

@rompetroll
Created January 28, 2016 14:45
Show Gist options
  • Save rompetroll/de2b4f39505a9a62a1ff to your computer and use it in GitHub Desktop.
Save rompetroll/de2b4f39505a9a62a1ff to your computer and use it in GitHub Desktop.
default methods
public class Test {
interface A {
default String a() {return "A";}
}
interface B {
default String b() {return "B";}
}
static class C implements A, B{}
public static void main(String... args) {
C c = new C();
System.out.println(c.a());
System.out.println(c.b());
D d = new D();
System.out.println(d.a());
//System.out.println(d.b()); //nope
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment