June 2018
Beginner
722 pages
18h 47m
English
We already said in Chapter 2, Java Language Basics, that in addition to abstract methods, an interface can have default methods and static members—constants, methods, and classes.
If an abstract, default, or static method m() already exists in an interface, one cannot add another method m() with the same signature (method name and list of parameter types). So, the following examples generate compilation errors because each pair of methods has the same signature, while the access modifier (private, public), static or default keywords, returned value type, and implementation are not part of the signature:
interface A { int m(String s); double m(String s); } interface B { int m(int s); static int m(int i) { return ...Read now
Unlock full access