Java Program to Implement Interface 'Animal'

Write a Java program to implement Interface 'Animal'.

Source Code
// Creating an interface 'Animal'
interface Animal {

	 public void eat();
	 public void travel();

public class MammalInt implements Animal {
	public void eat() {
		System.out.println("Mammal eats");

	public void travel() {
		System.out.println("Mammal travels");

	public int noOfLegs() {
		return 0;

	public static void main(String args[]) {
		MammalInt m = new MammalInt();;;
Mammal eats
Mammal travels

"Coding Hub - Learn to code" app now available on Google Play Store