OBJECT ORIENTED PROGRAMMING LAB
III B. TECH- I SEMESTER
Course Code Category Hours / Week Credits Maximum Marks
L T P C CIE SEE Total
A5IT02 PCC
- - 3 1.5 30 70 100
COURSE OBJECTIVES:
The course should enable the students to:
1. Practice object-oriented programs and build java applications.
2. Implement java programs for establishing interfaces.
3. Implement sample programs for developing reusable software components.
4. Create database connectivity in java and implement GUI applications.
COURSE OUTCOMES:
At the end of the course, student will be able to:
1. Implement Object Oriented programming concept using basic syntaxes of control Structures, strings and
function for developing skills of logic building activity.
2. Understand the use of different exception handling mechanisms and concept of multithreading for robust
and efficient application development.
3. Understand and implement concepts on file streams and operations in java programming for a a given
application programs.
4. Implement Collection Frameworks to retrieve and process data efficiently.
5. Develop java application to interact with database by using relevant software component (JDBC Driver).
LIST OF EXPERIMENTS
WEEK - 1 JAVA BASICS
a. Write a java program that prints all real solutions to the quadratic equation ax 2+bx+c=0. Read in a, b, c
and use the quadratic formula.
b. The Fibonacci sequence is defined by the following rule. The first two values in the sequence are 1 and 1.
Every subsequent value is the sum of the two values preceding it. Write a java program that uses both
recursive and non-recursive functions.
WEEK - 2 ARRAYS
a. Write a java program to sort given list of integers in ascending order.
b. Write a java program to multiply two given matrices.
WEEK - 3 STRINGS
a. Write a java program to check whether a given string is palindrome.
b. Write a java program for sorting a given list of names in ascending order.
WEEK - 4 OVERLOADING & OVERRIDING
a. Write a java program to implement method overloading and constructors overloading.
b. Write a java program to implement method overriding.
WEEK - 5 INHERITANCE
Write a java program to create an abstract class named Shape that contains two integers and an empty method
named print Area (). Provide three classes named Rectangle, Triangle and Circle such that each one of the classes
extends the class Shape. Each one of the classes contains only the method print Area () that prints the area of the
given shape.
WEEK - 6 INTERFACES
a. 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.
b. Write a program to give example for multiple inheritance in Java.
WEEK - 7 EXCEPTION HANDLING
Write a program that reads two numbers Num1 and Num2. If Num1 and Num2 were not integers, the program
would throw a Number Format Exception. If Num2 were zero, the program would throw an Arithmetic Exception
Display the exception.
WEEK - 8 I/O STREAMS
a. Write a java program that reads a file name from the user, and then displays information about whether
the file exists, whether the file is readable, whether the file is writable, the type of file and the length of
the file in bytes.
b. Write a java program that displays the number of characters, lines and words in a text file.
WEEK - 9 MULTI THREADING
a. Write a java program that implements a multi-thread application that has three threads. First thread generates
random integer every 1 second and if the value is even, second thread computes the square of the number and
prints.
If the value is odd, the third thread will print the value of cube of the number
b. Write a Java program that correctly implements producer consumer problem using the concept of inter thread
communication.
WEEK - 10 GENERICS
a. Write a Java program to swap two different types of data using Generics.
b. Write a Java program to find maximum and minimum of two different types of data using Generics.
WEEK - 11 COLLECTIONS
a) Create ArrayList and perform operations
b) Create LinkedList of elements.
i) Delete a given element from the above list.
ii) Display the contents of the list after deletion
WEEK - 12 DATABASE & EVENT HANDLING
a. Write a java program that connects to a database using JDBC and does add, delete, modify and
retrieve operations.
b. Write a Java program for handling mouse events.
c. Write a Java program for handling key events using Adapter classes
TEXT BOOKS:
1. P. J. Deitel, H. M. Deitel, “Java for Programmers”, Pearson Education, PHI, 4th Edition, 2007.
2. P. Radha Krishna, “Object Oriented Programming through Java”, Universities Press, 2nd Edition, 2007
3. Bruce Eckel, “Thinking in Java”, Pearson Education, 4th Edition, 2006.
4. Sachin Malhotra, Saurabh Chaudhary, “Programming in Java”, Oxford University Press, 5th Edition, 2010.