interface in jave 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: interface in java
/* File name : Animal.java */
interface Animal {
public void eat();
public void travel();
}