Lab Excercise 5
Lab Excercise 5
July-December 2014
EXPERIMENT 5
TITLE: Interface
1) Write a program to create interface named test. In this interface the member function is square.
Implement this interface in arithmetic class. Create one new class called ToTestInt in this class
use the object of arithmetic class
2) Write a program to create interface A in this interface we have two method meth1 and meth2.
Implements this interface in another class named MyClass.
3) Write a program in Java to show the usefulness of Interfaces as a place to keep constant value of
the program
4) Write a Program to show the implementation of cloneable interface for the following scenario.
a. A Class Employee having fields as id,name,department
b. A Class Department having fields as id,name.
c. A test Class which will create an employee obj & will load its value using constructor
of employee and department class respectively
d. Now create a new employee reference & try cloning & verify using showing their
values.
5) Write a program to create an Interface having two methods division and modules. Create a class,
which overrides these methods.