Skip to content

Instantly share code, notes, and snippets.

@Aroueterra
Created June 3, 2021 11:29
Show Gist options
  • Save Aroueterra/823e5a751dc7497840d643e03950329a to your computer and use it in GitHub Desktop.
Save Aroueterra/823e5a751dc7497840d643e03950329a to your computer and use it in GitHub Desktop.
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