interface keyword in java code example
Example 1: Interface in java
// interface syntax
interface InterfaceName
{
fields // by default interface fields are public, static final
methods // by default interface methods are abstract, public
}
Example 2: java interface
public interface Exampleinterface {
public void menthod1();
public int method2();
}
class ExampleInterfaceImpl implements ExampleInterface {
public void method1()
{
//code here
}
public int method2()
{
//code here
}
}