June 2018
Beginner
722 pages
18h 47m
English
Let's look at the following two interfaces:
interface B { String NAME = "B"; static int m(String d) { return 1; } class Clazz{ String m(){ return "B";} }}interface A extends B { String NAME = "A"; static int m(String d) { return 42; } class Clazz{ String m(){ return "A";} }}
Interface B is a parent (also called superinterface or base interface) of interface A (called a derived interface, child interface, subinterface, or subtype). All the members of an interface are public by default. Interface fields and classes are also static by default. So, all members of interfaces A and B are public and static. Let's, run the following code:
public static void main(String[] args) { System.out.println(B.NAME); System.
Read now
Unlock full access