How to define an Interface?

How to define an Interface?

Interface defines the methods but does not implements. Interface can include constants. A class that implements the interfaces must have implements (body) of all the methods defined in Interface.
Example of Interface: 

public interface TestR4R {

// variable may be only  public,final,static, must be initialized .

static int a = 0;

// methods are only public & abstract

void method2();

}

class Test implements TestR4R {

@Override

public void method2() {

}

}

Read More →