Interface Extends in Java
Interface Extends in Java
* abstract class
* abstract methods
* final variables(constants)
* static methods(must have body)
* abstract methods must override in sub class
* should use "public" access modifier.
public interface A {
//final fields
int x=20;
void show();//abstract method
static void display() {
}
}
interface A{
void show();
}
interface B{
void sum();
}
@Override
public void show() {
System.out.println(this.res);
}
Rule:
if sub class has no super class and implement super interfaces.
interface A{
}
interface B{
}
if sub class must ineherit to a class and two interfaces,then use extends first and
them implements.
class D{
}
interface A{
}
interface B{
}