interface A { final int k = 8; // Line 1 private int m; // Line 2 public void aMethod(); // Line 3 String fun(Char s); // Line 4 }back top next
interface A { void go(); } Class B { public void go() { System.out.println("GO!"); } } Class C extends B implements A {} Class Main { publci static void main(String[] args) { A a = new C(); a.go(); } }
interface A { int n = 111; } Class B implements A { void inc() { n++; } }back top next
interface ABC { void methodOne(); } interface PQR extends ABC { void methodTwo(int i); } abstract class XYZ implements PQR { public void methodOne() { methodTwo(2); } } class EFG extends XYZ { public void methodTwo(int i) { System.out.println(Math.pow(i, 2)) } } class Main { public static void main(String[] args) { ABC abc = new EFG(); abc.methodOne(); } }