Java LabManual
Java LabManual
Laboratory Manual
(Java Programming)
(DI03032021)
CTE’s MISSION
1. Quality technical and professional education with continuous improvement of all the resources and
personnel
2. To promote conducive ecosystem for Academic, Industry, Research, Innovations and Startups
3. To provide affordable quality professional education with moral values, equal opportunities, accessibility
and accountability
4. To allocate competent and dedicated human resources and infrastructure to the institutions for providing
world-class professional education to become a Global Leader (“Vishwa Guru”)
Institute’s Vision:
Institute’s Mission:
Department’s Vision:
Department’s Mission:
Name of institute
Certificate
Place: Rajkot
Date: …………………..
By using this lab manual, students can read procedure one day in advance to actual performance day of
practical experiment which generates interest and also, they can have idea of judgement of magnitude prior to
performance. This in turn enhances predetermined outcomes amongst students. Each and every Experiment
/Practical in this manual begins by competency, industry relevant skills, course outcomes as well as practical
outcomes which serve as a key role for doing the practical. The students will also have a clear idea of safety
and necessary precautions to be taken while performing experiment.
This manual also provides guidelines to lecturers to facilitate student-centered lab activities for each
practical/experiment by arranging and managing necessary resources in order that the students follow the
procedures with required safety and necessary precautions to achieve outcomes. It also gives an idea that how
students will be assessed by providing Rubrics.
Although we try our level best to design this lab manual, but always there are chances of improvement.
We welcome any suggestions for improvement.
Programme Outcomes (POs) to be achieved through Practical of this Course
Following programme outcomes are expected to be achieved through the practical of the
course:
1. Basic and Discipline specific knowledge: Apply knowledge of basic mathematics, science and
engineering fundamentals and engineering specialization to solve the engineering problems.
2. Problem analysis: Identify and analyze well-defined engineering problems using codified standard
methods
3. Design/ development of solutions Design solutions for well-defined technical problems and assist
with the design of systems components or processes to meet specified needs
4. Engineering Tools, Experimentation and Testing: Apply modern engineering tools and
appropriate technique to conduct standard tests and measurements
7. Life-long learning: Ability to analyze individual needs and engage in updating in the context of
technological changes.
Practical Outcome - Course Outcome matrix
Course Outcomes (COs):
a) Write simple Java programs using basic syntax, data types, and control structures.
b) Apply object-oriented programming concepts to solve real-world problems.
c) Develop Java applications using inheritance, interfaces, and packages.
d) Implement exception handling and multithreading in Java programs.
e) Develop Java applications using file handling and collections framework.
CO
S. No. Practical Outcome CO2 CO3 CO4 CO5
1
The following industry relevant skills of the competency “Develop java application using object-oriented
approach.” are expected to be developed in the student by undertaking the practical of this laboratory
manual.
Practical
Outcome / Date Marks
Sr Page Sign
Title of (25)
experiment
1. Install JDK, write a simple "Hello World"
program, compile, and execute using Java
compiler and interpreter.
9.
Create and implement interfaces for multiple
inheritance and define default methods
1|P a ge
Java Programming (DI03032021)
14.
Develop a program to read, write, and
manipulate text files using file streams
15.
Implement object serialization to save and
retrieve object states from files.
2|P a ge
Java Programming (DI03032021)
Date: ……………
Practical No: 1: Install JDK, write a simple "Hello World" program, compile, and
execute using Java compiler and interpreter.
A. Objective:
E. Practical Outcome(PRo)
Install JDK, write a simple “Hello World” or similar java program, compilation,
debugging, executing using java compiler and interpreter.
G. Prerequisite Theory:
● JDK Installation
● Java compiler Path configuration
● Install Text Editor
3|P a ge
Java Programming (DI03032021)
1. Go to "System Properties" (Can be found on Control Panel > System and Security >
System > Advanced System Settings)
2. Click on the "Environment variables" button under the "Advanced" tab
3. Then, select the "Path" variable in System variables and click on the "Edit" button
4. Click on the "New" button and add the path where Java is installed, followed by \bin. By
default, Java is installed in C:\Program Files\Java\jdk-11.0.1 (If nothing else was specified
when you installed it). In that case, You will have to add a new path with: C:\Program
Files\Java\jdk-11.0.1\bin
Then, click "OK", and save the settings
5. At last, open Command Prompt ([Link]) and type java -version to see if Java is running
on your machine
Step 1
Step 2
4|Page
Java Programming (DI03032021)
Step 3
Step 4
5|Page
Java Programming (DI03032021)
Step 5
If Java was successfully installed, you will see something like this (depending on version):
[Link]:-
public class Main {
public static void main(String[] args) {
[Link]("Hello World");
}
}
Save the code in Notepad as "[Link]". Open Command Prompt ([Link]),
navigate to the directory where you saved your file, and type
C:\Users\Your Name>javac [Link]
C:\Users\Your Name>java Main
H. Resources/Equipment Required
Sr. Instrument/Equipment Specification Quantit
No.
/Components/Trainer kit y
6|P a ge
Java Programming (DI03032021)
………………………………………………………………………………………………………………………………..
………………………………………………………………………………………………………………………………..…
……………………………………………………………………………………………………………………………..……
…………………………………………………………………………………………………………………………..………
………………………………………………………………………………………………………………………..…………
……………………………………………………………………………………………………………………..……………
…………………………………………………………………………………………………………………..………………
………………………………………………………………………………………………………………..…………………
……………………………………………………………………………………………………………..……………………
…………………………………………………………………………………………………………..………………………
………………………………………………………………………………………………………..…………………………
……………………………………………………………………………………………………..……………………………
…………………………………………………………………………………………………..………………………………
………………………………………………………………………………………………..…………………………………
……………………………………………………………………………………………..……………………………………
…………………………………………………………………………………………..………………………………………
………………………………………………………………………………………..…………………………………………
……………………………………………………………………………………..……………………………………………
…………………………………………………………………………………..………………………………………………
………………………………………………………………………………..…………………………………………………
……………………………………………………………………………..……………………………………………………
…………………………………………………………………………..………………………………………………………
………………………………………………………………………..…………………………………………………………
……………………………………………………………………..……………………………………………………………
…………………………………………………………………..………………………………………………………………
………………………………………………………………..…………………………………………………………………
……………………………………………………………..……………………………………………………………………
…………………………………………………………..………………………………………………………………………
………………………………………………………..…………………………………………………………………………
……………………………………………………..……………………………………………………………………………
…………………………………………………..………………………………………………………………………………
………………………………………………..…………………………………………………………………………………
……………………………………………..……………………………………………………………………………………
…………………………………………..………………………………………………………………………………………
7|P a ge
Java Programming (DI03032021)
………………………………………..…………………………………………………………………………………………
……………………………………..……………………………………………………………………………………………
……………………………………..……………………………………………………………………………………………
……………………………………..……………………………………………………………………………………………
……………………………………..……………………………………………………………………………………………
……………………………………..……………………………………………………………………………………………
K. Input-Output :
8|P a ge
Java Programming (DI03032021)
2. [Link]
3. [Link]
4. [Link]
N. Assessment-Rubrics
Performance Indicators Weightage
Process related (15 Marks) 70%
1. Logic formation 30%
2. Debugging ability 30%
3. Follow ethical practices 10%
Product related (10 Marks) 30%
4. Expected output 10%
5. Timely Submission of report 10%
9|P a ge
Java Programming (DI03032021)
Date: ……………
Practical No: 2: Write a Java program to implement basic arithmetic operations and
Demonstrate type casting
A. Objective:
PO2: Problem analysis: Identify and analyze well-defined engineering problems using
codified standard methods.
G. Prerequisite Theory:
10 | P a g e
Java Programming (DI03032021)
Java supports arithmetic operations like addition, subtraction, multiplication, division, and
modulus. These operations are performed using operators on variables. Type casting converts a
value from one data type to another, either implicitly or explicitly. It ensures compatibility and
precision in operations. This concept is important in mathematical and real-world applications.
Arithmetic operators in Java can be used with different data types like integers, floats, and
doubles. When two different data types are used, implicit type casting often occurs to avoid data
loss. This process is known as type promotion. Java ensures precise results by following a strict
type conversion system.
Explicit type casting is also possible by manually converting one data type into another. For
example, converting a double to an integer helps when only whole numbers are needed. Such
operations are common in financial calculations, scientific applications, and games.
Understanding casting makes programs more accurate and efficient.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
11 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
12 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
13 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
14 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 3: Create a class to represent a Student with appropriate attributes and methods, then
instantiate and manipulate Student objects
A. Objective:
Create a class to represent a Student with appropriate attributes and methods, then instantiate
and manipulate Student objects
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
Create a class to represent a Student with appropriate attributes and methods, then instantiate
and manipulate Student objects
G. Prerequisite Theory:
A class in Java defines attributes and behaviors of an entity. A Student class may include
attributes like name, roll number, and age along with methods to display or update them. Objects
15 | P a g e
Java Programming (DI03032021)
are created from the class to represent real-world entities. This demonstrates the concept of
object-oriented programming. It provides reusability and better data organization.
A Student class is an example of encapsulation, where attributes and methods are grouped
together. Encapsulation helps in controlling access to data using access modifiers. It keeps
information secure and prevents misuse. This concept is central to object-oriented design.
The use of objects also encourages modularity. Multiple student objects can be created and
managed independently within the same program. Each object holds its own set of data,
representing different students. This way, Java programs can simulate real-world systems like
school databases.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
16 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
17 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
18 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
19 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 4: Create a program that demonstrates the use of constructors and 'this' keyword.
A. Objective:
Create a program that demonstrates the use of constructors and 'this' keyword.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
Create a program that demonstrates the use of constructors and 'this' keyword.
G. Prerequisite Theory:
Constructors are special methods used to initialize objects when they are created. They may
accept parameters to assign values to variables at the time of object creation. The this keyword
refers to the current object and helps to differentiate between instance variables and parameters. It
also allows chaining of constructors. This ensures clarity and avoids ambiguity in code.
20 | P a g e
Java Programming (DI03032021)
Constructors can be overloaded, meaning multiple constructors with different parameter lists can
exist in the same class. This allows flexibility when creating objects with varying initial data. For
example, one constructor may assign default values, while another accepts parameters. Such a
design makes object initialization more versatile.
The this keyword is also used to call one constructor from another within the same class. This
avoids duplication of initialization code and improves readability. It also passes the current object
reference as an argument to other methods. Using this ensures better structure and consistency
in object handling.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
21 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
22 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
23 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
24 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 5: Develop a program to demonstrate method overloading for different operations.
A. Objective:
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
G. Prerequisite Theory:
Method overloading allows a class to have multiple methods with the same name but different
parameter lists. This provides flexibility to perform similar tasks with different input data. It
improves program readability and supports compile-time polymorphism. Overloading is widely
25 | P a g e
Java Programming (DI03032021)
used in mathematical operations and utility methods. It is an important feature of Java for
reusability.
Overloading also improves program maintainability. If a new type of input needs to be supported, a new
method can be added without disturbing existing ones. This reduces errors and enhances flexibility. It is
commonly applied in libraries and utility classes for maximum usability
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
26 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
27 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
28 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
Date: ……………
Practical No: 6: Implement a class with static methods, variables, and blocks, then demonstrate their
behaviour.
A. Objective:
Implement a class with static methods, variables, and blocks, then demonstrate their behaviour.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
PO7: Life-long learning: Ability to analyze individual needs and engage in updating in
the context of technological changes in field of engineering.
CO2: Use object oriented programming concepts to solve real world problems.
Implement a class with static methods, variables, and blocks, then demonstrate
their behaviour.
30 | P a g e
Java Programming (DI03032021)
G. Prerequisite Theory:
Static members belong to the class rather than individual objects. Static variables are shared
among all objects, ensuring common data storage. Static methods can be called without creating
an object. Static blocks are executed once when the class is loaded into memory. This helps in
initializing resources efficiently.
Static members are useful for representing information common to all objects of a class. For
example, a static counter can keep track of how many objects are created. This ensures
consistency without requiring multiple copies of the variable. Static methods are often used for
utility functions.
Static blocks are executed before the main method and are helpful for one-time setup. They can
initialize configuration files, constants, or resources. Since they run automatically, no explicit call
is needed. This makes programs more efficient and structured.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
31 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
32 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
33 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
34 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 7: Create a program to demonstrate single, multilevel, and hierarchical inheritance.
A. Objective:
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
G. Prerequisite Theory:
Inheritance is the process of deriving a new class from an existing one. The new class, called a
subclass, acquires properties and behaviors of the parent class. Java supports single, multilevel,
and hierarchical inheritance. This promotes reusability and establishes relationships between
classes. It also helps in implementing real-world models in programming.
35 | P a g e
Java Programming (DI03032021)
Inheritance also allows for reusability of code by extending existing classes. It avoids writing
duplicate code for related functionalities. Subclasses can add new features while keeping
inherited behavior intact. This reduces complexity in program design.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
36 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
37 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
38 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
K. Input-Output:
M. References / Suggestions
[Link]
[Link]
39 | P a g e
Java Programming (DI03032021)
N. Assessment-Rubrics
40 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 8: Implement method overriding and demonstrate dynamic method dispatch.
A. Objective:
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
G. Prerequisite Theory:
41 | P a g e
Java Programming (DI03032021)
method is executed based on the object type. It allows flexibility in extending existing behavior.
This is useful in designing frameworks and libraries.
Dynamic method dispatch is also known as runtime polymorphism. It ensures that the method
associated with the object type is executed, not the reference type. This is crucial when working
with references of parent classes pointing to child objects. It provides a flexible framework for
design.
Overriding also supports extensibility in programming. When new behavior is needed, subclasses
can redefine methods without changing existing code. This follows the principle of open for
extension, closed for modification. Such a practice is widely used in software development
frameworks.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
42 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
43 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
44 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
45 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 9: Create and implement interfaces for multiple inheritance and define default methods
A. Objective:
Create and implement interfaces for multiple inheritance and define default methods.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
Create and implement interfaces for multiple inheritance and define default methods.
G. Prerequisite Theory:
Interfaces in Java define abstract methods that must be implemented by classes. They provide a
way to achieve multiple inheritance and standardize behavior across different classes. From Java
8 onwards, interfaces can also contain default methods with implementations.
This allows backward compatibility and code reusability. Interfaces are widely used in
46 | P a g e
Java Programming (DI03032021)
Interfaces are considered a contract between classes. Any class that implements an interface
agrees to provide definitions for its methods. This ensures uniformity in behavior across different
classes. It also supports abstraction by hiding implementation details.
Default methods reduce the burden of updating all implementing classes when new features are
introduced. They allow backward compatibility without breaking older code. Interfaces combined
with default methods offer both flexibility and standardization. This balance is valuable in
modern Java programming.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
47 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
48 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
49 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
50 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 10: Implement exception handling using try, catch, and finally blocks for different
scenarios.
A. Objective:
Implement exception handling using try, catch, and finally blocks for different scenarios.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
Implement exception handling using try, catch, and finally blocks for different scenarios.
G. Prerequisite Theory:
Exceptions are runtime errors that disrupt normal program flow. Java provides mechanisms like
try, catch, and finally blocks to handle such situations. Exception handling ensures smooth
51 | P a g e
Java Programming (DI03032021)
execution by catching and resolving errors. It improves reliability and prevents program crashes.
Handling exceptions properly is an important aspect of secure coding.
Unchecked exceptions, such as runtime errors, occur due to invalid user inputs or logical
mistakes. Checked exceptions, on the other hand, must be handled explicitly by the programmer.
This distinction helps in writing safe and reliable programs. Exception handling ensures that
errors do not cause abrupt termination.
The finally block is used to close resources like files or database connections. It always
executes, regardless of whether an exception occurs. This ensures proper cleanup and resource
management. Exception handling thus plays a vital role in building secure applications.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
52 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
53 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
54 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
55 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 11: Develop a multithreaded application by extending Thread class to perform
concurrent tasks.
A. Objective:
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
PO7: Life-long learning: Ability to analyze individual needs and engage in updating in
the context of technological changes in field of engineering.
CO2: Use object oriented programming concepts to solve real world problems.
56 | P a g e
Java Programming (DI03032021)
G. Prerequisite Theory:
Multithreading is a feature that allows multiple tasks to run simultaneously within a program.
Each thread is an independent path of execution. Java provides the Thread class to create and
manage threads. This improves CPU utilization and program performance. Multithreading is
useful in gaming, animation, and server-based applications.
Multithreading provides concurrency, where multiple tasks progress at the same time. This is
different from parallelism, where tasks run truly simultaneously on multiple processors. Java’s
thread model provides synchronization to avoid conflicts between threads. This prevents issues
like data inconsistency.
Threads can have different priorities that affect their scheduling. High-priority threads may
execute before lower-priority ones. Thread lifecycle includes states like new, runnable, waiting,
and terminated. Understanding these states helps in better thread management.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
57 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
58 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
59 | P a g e
Java Programming (DI03032021)
1. What is multithreading?
2. How do you create a thread using the Thread class?
3. What is the difference between start() and run() methods?
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
60 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 12: Develop a program to demonstrate String class methods and string manipulation
operations.
A. Objective:
Develop a program to demonstrate String class methods and string manipulation operations.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
Develop a program to demonstrate String class methods and string manipulation operations.
G. Prerequisite Theory:
Strings are sequences of characters and are widely used in Java applications. The String class
provides many methods to manipulate and process text. Common operations include
concatenation, substring extraction, comparison, and case conversion.
Strings are immutable, meaning their content cannot be changed once created. Efficient handling
61 | P a g e
Java Programming (DI03032021)
Strings support methods like equals(), compareTo(), and substring() for comparing and
extracting parts of text. They also allow searching and replacing characters or words. These
functions make it easy to handle user input or file data. They are highly versatile for applications.
Since strings are immutable, every modification creates a new object. This ensures thread safety
and consistency in data handling. However, for frequent changes, classes like StringBuilder
and StringBuffer are used. They allow mutable operations with better performance.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
62 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
63 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
64 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
65 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 13: Implement a program using ArrayList and LinkedList to demonstrate List interface
capabilities.
A. Objective:
Implement a program using ArrayList and LinkedList to demonstrate List interface capabilities.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO2: Use object oriented programming concepts to solve real world problems.
Implement a program using ArrayList and LinkedList to demonstrate List interface capabilities.
G. Prerequisite Theory:
ArrayList and LinkedList are implementations of the List interface in Java. They allow
dynamic storage of elements and provide flexible data handling. An ArrayList is efficient for
accessing elements, while a LinkedList is better for frequent insertions and deletions. Both
support generic types and can grow in size dynamically. These collections are widely used in
real-world applications.
66 | P a g e
Java Programming (DI03032021)
ArrayLists store elements in a dynamic array, providing fast random access. However, insertions
and deletions in the middle are slower due to shifting of elements. LinkedLists store elements as
nodes connected with references. They are faster for frequent modifications.
Both ArrayList and LinkedList implement the List interface and support iteration. They provide
methods for adding, removing, and accessing elements efficiently. Their choice depends on the
type of operation required. This makes them flexible for different scenarios.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
67 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
68 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
69 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
70 | P a g e
Java Programming (DI03032021)
Date: ……………
Practical No: 14: Develop a program to read, write, and manipulate text files using file streams
A. Objective:
Develop a program to read, write, and manipulate text files using file streams
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO3: Develop an object-oriented program using inheritance and package concepts for a
given problem statement.
Develop a program to read, write, and manipulate text files using file streams
G. Prerequisite Theory:
File streams in Java allow reading from and writing to files. They provide a way to handle
external data storage. Character streams and byte streams are two categories used for different
data types. File handling is essential for storing and retrieving user data. This makes applications
more interactive and persistent.
71 | P a g e
Java Programming (DI03032021)
File streams are divided into byte streams and character streams. Byte streams handle binary data
like images, while character streams handle text files. Java provides classes like
FileInputStream and FileReader for this purpose. They ensure efficient data transfer between
programs and storage.
Files can also be opened in read or write modes as required. Proper file handling prevents data
loss and corruption. Applications like text editors, log systems, and databases use file streams.
This makes file I/O a fundamental part of Java.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
72 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
73 | P a g e
Java Programming (DI03032021)
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
74 | P a g e
Java Programming (DI03032021)
M. References / Suggestions
[Link]
[Link]
N. Assessment-Rubrics
75 | P a g e
Date: ……………
Practical No: 15: Implement object serialization to save and retrieve object states from files.
A. Objective:
Implement object serialization to save and retrieve object states from files.
PO2: Problem analysis: Identify and analyse well-defined engineering problems using
codified standard methods.
CO3: Develop an object-oriented program using inheritance and package concepts for a
given problem statement.
Implement object serialization to save and retrieve object states from files.
G. Prerequisite Theory:
Serialization is the process of converting an object into a byte stream for storage or transfer. It
allows saving the state of an object in a file or sending it over a network. Deserialization is the
reverse process of reconstructing the object. This feature is widely used in distributed systems
and databases. It provides a way to maintain data consistency across platforms.
Serialization supports portability by enabling objects to be shared across different machines. It is
often used in network programming and web services. The serialized form of an object can be
transmitted easily between client and server. This helps in building distributed systems.
Serialized data can also be stored in files for later use. When deserialized, objects retain their
original state and behavior. This feature is useful for saving user preferences or application
settings. Serialization ensures both persistence and transportability of data.
H. Resources/Equipment Required
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………………………………
………………………………………………………..…..…………………………………………………………………………………
……………………………………………..
K. Input-Output:
N. Assessment-Rubrics