SHOW:
|
|
- or go back to the newest paste.
| 1 | // Duplicate default methods named abc with the parameters () and () are inherited from the types C and B | |
| 2 | ||
| 3 | - | public void abc() {
|
| 3 | + | |
| 4 | - | System.out.println("Class A");
|
| 4 | + | |
| 5 | - | } |
| 5 | + | |
| 6 | ||
| 7 | interface B {
| |
| 8 | ||
| 9 | default void abc() {
| |
| 10 | - | default void abc() {
|
| 10 | + | System.out.println("Interface B");
|
| 11 | - | System.out.println("Interface B");
|
| 11 | + | } |
| 12 | - | } |
| 12 | + | |
| 13 | ||
| 14 | interface C {
| |
| 15 | - | public class Test extends A implements B {
|
| 15 | + | |
| 16 | default void abc() {
| |
| 17 | - | public static void main(String[] args) {
|
| 17 | + | System.out.println("Interface C");
|
| 18 | - | Test t = new Test(); |
| 18 | + | } |
| 19 | - | t.abc(); |
| 19 | + | |
| 20 | - | } |
| 20 | + | |
| 21 | public class Test extends A implements B, C {
| |
| 22 | ||
| 23 | public static void main(final String[] args) {
| |
| 24 | final Test t = new Test(); | |
| 25 | t.abc(); | |
| 26 | } | |
| 27 | } |