Answer the question
In order to leave comments, you need to log in
How to determine which default method to call?
I have an interesting question about toad8 here: There are 2 interfaces with 2 default methods with the same name, how is it possible to determine which interface to pull the method from?
interface Test1 {
default String test() {
return "a";
}
}
interface Test2 {
default String test() {
return "b";
}
}
public class Abc implements Test1, Test2 {
public static void main() {
System.out.println(new Abc().test());
}
}
Answer the question
In order to leave comments, you need to log in
This is not possible, the compiler will give an error due to a method collision)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question