public Interface Person {
void printNickName();
/**
* @impleSpec
* getName()에 Person 를 붙여 출력한다.
*/
default void printPerson() {
System.out.println(getName()+" Person");
}
String getName();
}
public Interface Friend extends Person{
void printNickName();
void printPerson() ;
String getName();
}
다야몬드 problem
public Interface OnlyPerson {
/**
* @impleSpec
* getName()에 Person 를 붙여 출력한다.
*/
default void printPerson() {
System.out.println("person");
}
}
<수정>
public class defualtPerson implement Person, OnlyPerson{
pubic void getPerson() {
printPerson()
}
@Override
public void printNickName(){
...
}
pubic String getName(){
...
}
}
public Interface Person {
...
/**
* @impleSpec
* getName()에 Person 를 붙여 출력한다.
*/
default void printPerson() {
System.out.println("person");
}
static void printAddress() {
System.out.println("Address");
}
}
Person.printAddress();