Created
January 28, 2016 14:45
-
-
Save rompetroll/de2b4f39505a9a62a1ff to your computer and use it in GitHub Desktop.
default methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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