0% found this document useful (0 votes)
5 views2 pages

Java.9 Java

The document presents a Java programming assignment by Tanmay Mahajan, focusing on the implementation of interfaces. It includes source code for interfaces 'AnimalEat' and 'AnimalTravel', along with a class 'Animal' that implements these interfaces. The program demonstrates the functionality by creating an instance of 'Animal' and calling its methods to display messages about eating and traveling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Java.9 Java

The document presents a Java programming assignment by Tanmay Mahajan, focusing on the implementation of interfaces. It includes source code for interfaces 'AnimalEat' and 'AnimalTravel', along with a class 'Animal' that implements these interfaces. The program demonstrates the functionality by creating an instance of 'Animal' and calling its methods to display messages about eating and traveling.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Tanmay Mahajan

Class: SYCO
Roll No: 6
Subject: Java programming
Subject Code: 314317
Pratical Name: 9.develop program for implementation of interface.
---------------------------------------------------------------------------------------------------------------------------------------
Source code:
interface AnimalEat
{
void eat();
}
interface AnimalTravel
{
void travel();
}
class Animal implements AnimalEat, AnimalTravel
{
public void eat()
{
System.out.println("Animal is eating");
}
public void travel()
{
System.out.println("Animal is travelling");
}
}
public class DemoInterface
{
public static void main(String args[])
{
Animal a = new Animal();
a.eat();
a.travel();
}
}

Output:-

Animal is eating

Animal is travelling

You might also like