Click here to watch in Youtube :
https://www.youtube.com/watch?v=KK-2hNbZIgw&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java Interface (Duplicate default methods-Super) |
interface InterfaceA { default void sayHello() { System.out.println("default Hello by InterfaceA..."); } }
public interface InterfaceB { default void sayHello() { System.out.println("default Hello by InterfaceB..."); } }
public class MyClass implements InterfaceA,InterfaceB { public void sayHello() { InterfaceA.super.sayHello(); } }
public class InterfaceTest { public static void main(String[] args) { InterfaceA interfaceARef = new MyClass(); interfaceARef.sayHello(); } }
default Hello by InterfaceA...
https://sites.google.com/site/javaee4321/java/InterfaceDemo-DuplicateDefault-Super-App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/InterfaceDemo-DuplicateDefault-Super-App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/d3069ae3fffccb0c6ba4336662b6a2619d880c61/BasicJava/InterfaceDemo-DuplicateDefault-Super-App/?at=master
See also:
No comments:
Post a Comment