Java Lab Lesson Plan Final-2025
Java Lab Lesson Plan Final-2025
Discipline : CSE
L-T-P-Cr : 0-0-2-1
Course Outcomes:
Upon completion of this course, the students will be able to:
CO2: Write java programs using basic object oriented programming concepts
CO6: Design GUI application using Swing and interactive application using event
handling and JDBC
List of Programs :
1. Aim of the program -Write a program to print your name, roll no, section and
branch in separate lines.
2. Aim of the program: Write a program to print the corresponding grade for the
given mark using if..else statement in Java
3. Aim of the program: Write a program to print the week day for the given day no.
of the current month using switch case statement
4. Aim of the program : Program to check a user entered number is palindrome or not
5. Aim of the program : Write a program in Java to take first name and last name from
user and print both in one line as last name followed by first name
1. Aim of the program : Find the largest among 3 user entered nos. at the command
prompt using Java
2. Aim of the program : Accept 10 numbers from command line and check how many
of them are even and how many are odd.
3. Aim of the program: Program to sort the user entered list of numbers of any
size
4. Aim of the program: Program to find no. of objects created out of a class using
‘static’ modifier.
5. Aim of the program: Find the no. of occurrence of each element in a user
entered list of nos.
6. Aim of the program: Find sum of each diagonal (left & right) elements
separately of a user entered 3 X 3 matrix in Java.
1. Aim of the program :Write a class file – box with three data members(length,
width, height) and a method volume() . Also implement the application class Demo
where an object of the box class is created with user entered dimensions and
volume is printed.
2. Aim of the program : Write a program in Java to create a class Rectangle having data
members length and breadth and three methods called read, calculate and display to read
the values of length and breadth, calculate the area and perimeter of the rectangle and
display the result respectively.
3. Aim of the program : Write a program in java to input and display the details of n
number of students having roll, name and cgpa as data members. Also display the
name of the student having lowest cgpa.
Input: Enter Roll No, Name and cgpa of ‘n’ number of students.
Output: Display the details of ‘n’ number of students. Also display the
name of student with lowest cgpa
4. Aim of the program : Write a program to overload subtract method with various
parameters in a class in Java. Write the driver class to use the different subtract
methods using object.
5. Aim of the program : Write a program which will overload the area () method and
display the area of a circle, triangle and square as per user choice and user entered
dimensions.
1. Aim of the program : A Plastic manufacturer sells plastic in different shapes like 2D
sheet and 3D box. The cost of sheet is Rs 40/ per square ft. and the cost of box is Rs 60/
per cubic ft. Implement it in Java to calculate the cost of plastic as per the dimensions
given by the user where 3D inherits from 2D.
3. Aim of the program : Write a program in Java having three classes Apple,
Banana and Cherry. Class Banana and Cherry are inherited from class Apple and
each class have their own member function show() . Using Dynamic Method
Dispatch concept display all the show() method of each class.
4. Aim of the program :Write a class Account containing acc_no, balance as data
members and two methods as input() for taking input from user and disp() method
to display the details. Create a subclass Person which has name and aadhar_no as
extra data members and override disp() function. Write the complete program to
take and print details of three persons.
1. Aim of the program -Illustrate the usage of abstract class with following Java
classes –
An abstract class ‘student’ with two data members roll no, reg no, a method getinput()
and an abstract method course()
A subclass ‘kiitian’ with course() method implementation
Write the driver class to print the all details of a kiitian object.
2. Aim of the program -Define an interface Motor with a data member –capacity and
two methods such as run() and consume(). Define a Java class ‘Washing machine’
which implements this interface and write the code to check the value of the interface
data member thru an object of the class.
Input - mentioned in the program
Output - Capacity of the motor is -----
4. Aim of the program - Define an interface Emploee with a method getDetails() to get
emplyee details as Empid and Ename. Also define a derived interface Manager with a
method getDeptDetails() to get department details such as Deptid and
Deptname.Then define a class Head which implements Manager interface and also
prints all details of the employee. Write the complete program to display all details of
one head of the department.
5. Aim of the program - Define two packages as – General and Marketing. In General
package define a class ‘employee’ with data members as empid(protected),
ename(private) and a public method as earnings() which calculate total earnings as
In Marketing package define a class ‘sales’ which is extending from ‘employee’ class
and has a method tallowance() which calculates Travelling Allowance as 5% of total
earning. Write the programs to find out total earning of a sales person for the given
basic salary amount and print along with the emp id.
Input: Enter the employee id and emploee name 123 Amit
Enter the basic salary 1000
Output: The emp id of the employee is 123
The total earning is 1950.0
3. Aim of the program- Write a Java class which has a method called
ProcessInput(). This method checks the number entered by the user. If the
entered number is negative then throw an user defined exception called
NegativeNumberException, otherwise it displays the double value of the
entered number.
4. Aim of the Program: Write a program to create user defined exceptions called
HrsException, MinException and SecException. Create a class Time which
contains data members hours, minutes, seconds and a method to take a time
from user which throws the user defined exceptions if hours (>24
&<0),minutes(>60 &<0),seconds(>60 &<0).
Input: 4 3 2 1
Output : 30
Input: 4 3 2
Output : Exception occurred - CheckArgument
List of Programs :
1. Aim of the program -Write a program to perform following operations on user
entered strings and a character –
i) Change the case of the string
ii) Reverse the string
iii) Compare two strings
iv) Insert one string into another string
v) Convert the string to upper case and lower case
vi) Check whether the character is present in the string and at which position
vii) Check whether the string is palindrome or not.
viii) Check the number of word, vowel and consonant in the string
2. Aim of the program - Write a java program which will accept students details
like Student RollNo, Name, Subject, Marks from the keyboard using scanner
class, stored the same in a file. Again open the file, read the content and
display all.
3. Aim of the program - Write a program in Java to copy the content of a given
file to another user entered file using character stream (using File Reader and
FileWriter Classes) and byte Stream (using FileInputStream and
FileOutputStream Class).
Input: Enter the source file name - sourcefile.txt (Assume Input file
exists in the system)
Enter the destination file name - destinationfile.txt
Output: File Copied
4. Aim of the program -Write a java program to compare two binary files, printing
the first byte position where they differ.
Input: Specify two binary files in the program (Assume two files are exist in
the system)
Output: Two files are equal
Input: Specify two binary files in the program
Output: Two files are not equal: byte position at which two files differ is 30
5. Aim of the program -Write a java program that displays the number of
characters, no. of lines and no. of words present in a text file whose name is
given by the user.
List of Programs :
1. Aim of the program - Write a program in Java using multi-threading which will
display a counter value within a specified range with a gap of 5 milliseconds after
setting it’s name as given by the user.
Input : Name of the thread - First
Lower range of counter - 10
Upper range of counter - 15
Output : Thread - First
Counter - 10 11 12 13 14 15
2. Aim of the program -Write a program in java which will display the working of two
threads in synchronization.
Input:
Output:
3. Aim of the program -Design a Stop Watch using event handling and multi-
threading in Java.
1. Aim of the program - Design a swing application using event and multithreading
which will display multiple images one after another moving in a square shape with a gap
of 10 millisecond. At the same time, four messages like - " Welcome "," Enjoy "," Thanks ","
Visit Again " will also be displayed one after another on the same page.
List of Programs :
1. Aim of the program -Write a java program which will display all the records from
the student table.
Input : Table name mentioned in the program
Output :
2205123 rakesh yadav 76
3. Aim of the program - Write a java program which will insert a record, update and
delete a particular record in the student table.
Input : Enter rollno to be inserted : 2205650
Enter name : Aditya Bajaj
Enter marks : 93
Output : 1 record inserted
4. Aim of the program -Write a java program which will display all the records from
the student table along with the column heading.
Input :Table name mentioned in the program
Here the user will write a query in the text field and then click on the execute query
button. The output of the query will be displayed on another hidden text area.
Input : select mark from student where rollno= 2205230
Output : 82
Aim of the program -Design an interface as shown below using Frame and Swing in Java
.
The user will fill up the details and after clicking on the insert button, the data will be
inserted in the table. Similarly Update button will update the record based on the Roll No
and in the same way delete button will delete the corresponding record from the table.
Input : Rollno - 2205423
Name - Manish Malhotra
Marks - 84
Output : On clicking Insert button - one record inserted
On clicking Update button - one record updated
On clicking Delete button - one record deleted
List of Programs :
1. Aim of the program -Design a registration form using Swing with following
components on it – Label, Textbox, Text area, Checkbox, Radio button and Button,
Image.
2. Aim of the program -Write a GUI program in Java with three Labels – Enter the First
Number, Enter the Second Number, Result, and three text fields for - first number,
second number and result and four buttons - Add, Sub, multiply and reset as shown
below. On clicking of any of these buttons, the corresponding operation should be
performed with input1 and input2 and the result should be displayed in the result box.
3. Aim of the program -Implement a GUI application which consists of one List Box
and one button. The list box will have four different color names. When the user will
select a color from the list box and click on the button, the panel color will be
changed to that color.
4. Aim of the program -Design a GUI application which consists of three Label
named as Red, Green and blue, three combo boxes which will consist the value from
0 to 255 and one button named as show output. The user will select different values
from three combo boxes. When the user clicks on the button, the panel background
will be changed accordingly as per the value passed in RGB format.
1. Aim of the program -Design a GUI Calculator as shown below using frame and
action event in Java.
Input: Any two number with one operator and then click on = button.
Output: Appropriate result will be displayed.
2. Aim of the program -Design a GUI application as shown below which consists of
two text fields and various buttons for String operations. On clicking any of the
button, the corresponding operation will be performed on the entered string in the
first text field and the resultant string will be displayed in the second text field.
Input: Any string in the fist text field and click on any button.
Output: Modified string in the second field
Grading Policies:
Continuous Evaluation components
Internal Evaluation (Continuous Evaluation over the semester which includes
Quiz/Viva/Lab Record/Lab performance/Attendance etc.) : 60 Marks
Reference Materials:-
Reference Book: