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