0% found this document useful (0 votes)
181 views

Lab Excercise 5

1) The document provides 5 programming exercises to practice working with interfaces in Java. The first exercise has the learner create an interface with a square method and implement it in a class. The second asks to create an interface with two methods and implement it in another class. The third is to use an interface to store constant values. The fourth involves implementing the Cloneable interface to clone an Employee object. The fifth has the learner create an interface with two math methods and override them in a class. The exercises cover creating and implementing interfaces and using them for constants and cloning objects.

Uploaded by

UjjWal MahAjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
181 views

Lab Excercise 5

1) The document provides 5 programming exercises to practice working with interfaces in Java. The first exercise has the learner create an interface with a square method and implement it in a class. The second asks to create an interface with two methods and implement it in another class. The third is to use an interface to store constant values. The fourth involves implementing the Cloneable interface to clone an Employee object. The fifth has the learner create an interface with two math methods and override them in a class. The exercises cover creating and implementing interfaces and using them for constants and cloning objects.

Uploaded by

UjjWal MahAjan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Core Java

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.

For B.tech CSE+ OSS 3rd Year

You might also like