An interface in Java is a blueprint of a class that includes static constants and abstract methods. Interfaces are used to provide a common set of methods that can be accessed and used by any class, regardless of its specific implementation.
Example:
public interface Animal {
public void eat();
public void move();
}
public class Dog implements Animal {
public void eat() {
System.out.println(“The dog is eating.”);
}
public void move() {
System.out.println(“The dog is running.”);
}
}