Created
September 3, 2017 16:58
-
-
Save LazaroIbanez/a260bbda387bf7d17308477bb4f2cc78 to your computer and use it in GitHub Desktop.
The default keyword
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 D implements Interface2 { | |
public static void main (String… args) { | |
Interface1 acct = new D(); | |
System.out.println(acct.getId()); | |
} | |
public String getId() { | |
return “1111”; | |
} | |
} | |
interface Interface1 { | |
public default String getId() { | |
return “0000”; | |
} | |
} | |
interface Interface2 extends Interface1 { | |
public String getId(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment