Created
June 3, 2021 11:29
-
-
Save Aroueterra/823e5a751dc7497840d643e03950329a to your computer and use it in GitHub Desktop.
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
interface Parent1 { | |
public String identify(); | |
public default String identify2() { | |
return "This method is called from Parent1"; | |
} | |
} | |
interface Parent2 { | |
public String identify(); | |
public default String identify3() { | |
return "This method is called from Parent2"; | |
} | |
} | |
//add class definitions below this line | |
class Child implements Parent1, Parent2 { | |
public String identify() { | |
return "This method is called from Child"; | |
} | |
// public String identify2() { | |
// return "This method is called from Parent1"; | |
// } | |
// public String identify3() { | |
// return "This method is called from Parent2"; | |
// } | |
} | |
//add class definitions above this line | |
public class Exercise3 { | |
public static void main(String[] args) { | |
//add code below this line | |
Child childObject = new Child(); | |
System.out.println(childObject.identify()); | |
System.out.println(childObject.identify2()); | |
System.out.println(childObject.identify3()); | |
//add code above this line | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment