???????????????Java???c++???????????Java????ж?????????? ???Java???????????(extends)???????? ??????????(implements)??????????????????г????????????????????о????????????????з????????????
??????Щ????????????????????Java 8?????? ????????????巽????(default method)?? ??????????????????????
????????????????? ???????е????????Java???????????μ????? ????????Щ????????????? ???磬 ?????Collection?????
????????default Stream<E> stream()?? ?????Set??List??????????????????????????? ????????????????copy?????????
?????????????????????????????????Java????????е????? ????????? ???????н??? ???????????????? ?????е??????????????????????????? ????????????????? ??????????????????У? ?????????????Java???е????
????????ж???????
????????????????Interface A?? Interface B?? Interface C?? ??й?????£?
????+---------------+         +------------+
????|  Interface A  |         |Interface B |
????+-----------^---+         +---^--------+
????|                 |
????|                 |
????|                 |
????+-+------------+--+
????| Interface C|
????+------------+
????A??B?????????????????default String say(String name)?? ??????C???override????????? ?????????
????interface A {
????default String say(String name) {
????return "hello " + name;
????}
????}
????interface B {
????default String say(String name) {
????return "hi " + name;
????}
????}
????interface C extends A??B{
????}
?????????????
????C:Lambdasrc>javac -J-Duser.country=US comcolobulambdachap
????ter3MultipleInheritance1.java
????comcolobulambdachapter3MultipleInheritance1.java:17: error: interface C inherits unrelated defaults for say(String) from types A and B
????static interface C extends A??B{
????^
????1 error
?????????????????C?и???override????????? ????????????????
????interface C extends A??B{
????default String say(String name) {
????return "greet " + name;
????}
????}
?????????????????????????????? ??????????????????????????????????????????????????????????A??B????????????? C????????????????????