IMS ENGINEERING COLLEGE
LABORATORY FILE
Object Oriented Programming with java
(BCS-452)
[Link] – II YEAR
(EVEN SEM 2024-2025)
Name
Roll No.
Section-Batch
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
IMS ENGINEERING COLLEGE
(Affiliated to Dr A P J Abdul Kalam Technical University, Lucknow )
Approved by AICTE - Accredited by NAAC – ‘A’ Grade
NH#24, Adhyatmik Nagar, Ghaziabad, UP, India
[Link]
Vision and Mission of the Institute and Department
Vision:
To make IMSEC an Institution of Excellence for empowering students through technical education,
incorporating human values, and developing engineering acumen for innovations and leadership skills to
upgrade society.
Mission:
Mission 1: To promote academic excellence by continuous learning in core and emerging
Engineering domains using innovative teaching and learning methodologies.
Mission 2: To inculcate values and ethics among the learners.
Mission 3: To promote industry interactions and cultivate young minds for entrepreneurship.
Mission 4: To create a conducive learning ecosystem and research environment on a perpetual basis to
develop students as technology leaders and entrepreneurs who can address tomorrow’s societal needs.
Vision of the Department
To provide globally competent professionals in the field of Computer Science & Engineering embedded
with sound technical knowledge, aptitude for research and innovation, and nurture future leaders with
ethical values to cater to the industrial & societal needs.
Mission of the Department
Mission 1: To provide quality education in both the theoretical and applied foundations of Computer
Science & Engineering.
Mission 2: Conduct research in Computer Science & Engineering resulting in innovations thereby
nurturing entrepreneurial thinking.
Mission 3: To inculcate team building skills and promote life-long learning with a high societal and
ethical values.
1
Program Outcomes (POs) and Program Specific Outcomes (PSOs)
S. No. Program Outcomes / Program Specific Outcomes
Engineering knowledge: Apply the knowledge of mathematics, science, engineering
PO1. fundamentals, and an engineering specialization to the solution of complex
engineering problems.
Problem analysis: Identify, formulate, review research literature, and analyze
PO2. complex engineering problems reaching substantiated conclusions using first
principles of mathematics, natural sciences, and engineering sciences.
Design/development of solutions: Design solutions for complex engineering
problems and design system components or processes that meet the specified
PO3.
needs with appropriate consideration for the public health and safety, and the
cultural, societal, and environmental considerations.
Conduct investigations of complex problems: Use research-based knowledge
PO4. and research methods including design of experiments, analysis and interpretation
of data, and synthesis of the information to provide valid conclusions.
Modern tool usage: Create, select, and apply appropriate techniques, resources,
PO5. and modern engineering and IT tools including prediction and modelling to
complex engineering activities with an understanding of the limitations.
The engineer and society: apply reasoning informed by the contextual knowledge to
PO6. assess societal, health, safety, legal and cultural issues and the consequent
responsibilities relevant to the professional engineering practice.
Environment and sustainability: Understand the impact of the professional
PO7. engineering solutions in societal and environmental contexts, and demonstrate the
knowledge of, and need for sustainable development.
Ethics: Apply ethical principles and commit to professional ethics and
PO8.
responsibilities and norms of the engineering practice.
Individual and team work: Function effectively as an individual, and as a member
PO9.
or leader in diverse teams, and in multidisciplinary settings.
Communication: Communicate effectively on complex engineering activities
with the engineering community and with society at large, such as, being able to
PO10.
comprehend and write effective reports and design documentation, make effective
presentations, and give and receive clear instructions.
Project management and finance: Demonstrate knowledge and understanding of
the engineering and management principles and apply these to one’s own work, as a
PO11.
member and leader in a team, to manage projects and in multidisciplinary
environments.
Life-long learning: Recognize the need for, and have the preparation and
PO12. ability to engage in independent and life-long learning in the broadest context of
technological change.
To analyze and demonstrate, the recent engineering practices, ethical values and
PSO1:
strategies in real time world problems to meet the challenges for the future.
To develop adaptive computing system using computational intelligence strategies
and algorithmic design to address diverse data analysis and machine learning
PSO2: challenges.
2
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)
CSE Department Program Educational Objectives (PEOs)
B. Tech Computer Science & Engineering Department has the following Program Educational
Objectives:
PEO1: Possess core theoretical and practical knowledge in Computer Science and Engineering
for successful career development in industry, pursuing higher studies or entrepreneurship.
PEO2: Ability to imbibe life-long learning for global challenges to impact society and environment.
PEO3: To demonstrate work productivity with leadership and managerial skills having ethics and
human value in progressive career path.
PEO4: To exhibit communication skill and collaborative skill plan and participate in
multidisciplinary fields of Computer Science & Engineering.
CSE Department Program Specific Outcomes (PSOs)
[Link] Computer Science & Engineering Department has the following Program Specific
Outcomes:
PSO1: To analyze and demonstrate, the recent engineering practices, ethical values and strategies
in real time world problems to meet the challenges for the future.
PSO2: To develop adaptive computing system using computational intelligence strategies and
algorithmic design to address diverse data analysis and machine learning challenges.
.
3
PROGRAM OUTCOMES
Engineering Graduates will be able to:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of
mathematics, natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and
environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex
engineering activities with an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and
need for sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and
write effective reports and design documentation, make effective presentations, and give
and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member
and leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage
in independent and life-long learning in the broadest context of technological change.
4
DETAILS OF THE PRACTICAL CONDUCTED
INDEX
[Link] TITLE OF THE PRACTICAL DATE FACULTY
OF SIGNATU
SUBMIS RE
SION
1 Use Java compiler and eclipse platform to write and execute java
program.
2 Creating simple java programs using command line arguments
3 Understand OOP concepts and basics of Java programming.
4 Create Java programs using inheritance and polymorphism.
5 Implement error-handling techniques using exception handling
and multithreading.
6 Create java program with the use of java packages.
7 Construct java program using Java I/O package.
8 Create industry oriented application using Spring Framework.
9 Create Test RESTful web services using Spring Boot.
10
Create Test Frontend web application with Spring Boot
11 Create a functional interface with a method that takes two
integers and returns their sum. Implement it using a lambda
expression.
5
12
How to Use for Each with a Lambda Expression to Iterate Over a
List in Java?
13 Create an ArrayList of integers and add ten elements to it. Iterate
over the list using a lambda.
14
Create an vector of integers and add ten elements to it. Iterate
over the list using a lambda.
15
Write a Java program to create a Hash table<Integer, String>
and add five key-value pairs. Print the hash table.
6
IMS Engineering College
NH-09, Adhyatmik Nagar, Near Dasna, Distt. Ghaziabad, U.P.
Tel: (0120) 4940000
Department of Computer Science and Engineering
Course Name: OOP With Java Lab Course Code: BCS-452
Semester / Year: 4th /2nd NBA Code: C 233
Bloom’s
COURSEOUTCOMES Level
Demonstrate java compiler and eclipse platform and learn how to use net
C233.1 beans IDE to create java application K4
C233.2 Ability to solve problem using interfaces, Inheritance and packages..
K1
C233.3 Ability to solve the problem using input output streams.
K2
C233.4 Implement exception handling and Templates
K3
C233.5 Develop and implement website using java spring frame work
K2
CO-PO Matrix
Course
PO PO1 PO1 PO1 PSO PSO
Outcom PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9
1 0 1 2 1 2
e
C233.1 3 3 2 2 2 1 1 1 3 3 2 3 3 3
C233.2 3 3 2 2 2 1 1 1 3 3 2 3 3 3
C233.3 3 3 2 2 2 1 1 1 3 3 2 3 3 3
C233.4 3 3 2 2 3 1 1 1 3 3 2 3 3 3
C233.5 3 3 2 2 3 1 1 1 3 3 2 3 3 3
Avg
3 3 2 2 2.4 1 1 1 3 3 2 3 3 3
7
LIST OF PROGRAMS
Subject: Object oriented programming with java Lab Sub Code: BCS-452
[Link]. NAME OF MAPPING
EXPERIMENT WITH CO
Use Java compiler and eclipse platform to write and execute
1 java program. C233.1
Creating simple java programs using command line arguments
2 C233.1
Understand OOP concepts and basics of Java programming.
3 C233.1
Create Java programs using inheritance and polymorphism. C233.2
4
Implement error-handling techniques using exception handling
5 C233.4
and multithreading.
Create java program with the use of java packages.
6 C233.3
Construct java program using Java I/O package.
7 C233.3
Create industry oriented application using Spring Framework.
8 C233.5
Create Test RESTful web services using Spring Boot.
9 C233.5
Create Test Frontend web application with Spring Boot C233.5
10
8
Create a functional interface with a method that takes two C233.2
11 integers and returns their sum. Implement it using a lambda
expression.
How to Use for Each with a Lambda Expression to Iterate Over C233.2
12 a List in Java?
Create an Array List of integers and add ten elements to it. C233.3
13 Iterate over the list using a lambda.
Create a vector of integers and add ten elements to it. Iterate C233.3
14 over the list using a lambda.
Write a Java program to create a Hash table<Integer, String> C233.3
15 and add five key-value pairs. Print the hash table.
9
EXPERIMENT NO. -1
AIM: Use Java compiler and eclipse platform to write and execute java program.
Procedure: Open Eclipse and click File > New > Java Project. Step 2: Provide the Project Name
and click on the Finish button. Step 3: In the Package Explorer (left-hand side of the window)
select the project which you have created. Step 4: Right-click on the src folder, select New > Class
Step 1: Open Eclipse and click File > New > Java Project. How to Run Java
Program in eclipse.
Step 2: Provide the Project Name and click on the Finish button
Step 3: In the Package Explorer (left-hand side of the window) select the project which you
have created.
10
Step 4: Right-click on the src folder, select New > Class from the submenu. Provide the Class name
and click on Finish button.
11
Source Code:
1.
class FirstProgram
{
public static void main (String args[])
{
[Link] ("Hello Java");
[Link] ("Welcome to IMS Engineering College");
}
}
---------------------------------------------------------------------------------------------------------------------
2.
class B_tech
{
public void aa()
{
int a=100;
a++;
++a;
[Link] (a);
}
public void bb()
{
int b=200;
int c;
c=b++ + b++;
[Link](c);
}
public static void main (String args[])
{
B_tech obj=new B_tech();
[Link]();
[Link]();
}}
12
3.
class A {
public void Login()
{
int k=100;
[Link](k++);
}
public void Password()
{
String pass="imsec";
[Link](pass);
}}
class B
{
public static void main(String args[])
{
A obj=new A();
[Link](); [Link]();
}
}
13
EXPERIMENT NO. -2
AIM:-Creating simple java programs using command line arguments.
Procedure: The command line argument is an argument i.e. passed at the time of running the javaprogram. The
arguments passed from the console can be received in the java program and it can be used as an input. So, it
provides a convenient way to check the behavior of the program for the different values. You can pass N (1,2,3 and
so on) numbers of arguments from the command prompt.
Source Code:
class MCA { public static void main(String args[]) {
[Link] ("Your first argument is: "+args[0]); }
}
class abc
{
public static void main(String args[])
{
for(int i=0;i<[Link];i++)
{
[Link] (args[i]);
}
}
}
14
15
EXPERIMENT NO. -3
AIM: Understand OOP concepts and basics of Java programming.
Procedure:
Object-Oriented Programming is a paradigm that provides many concepts, such as inheritance, data binding,
polymorphism, etc.
Object:-
Java Object Any entity that has state and behavior is known as an object. For example, a chair, pen, table,
keyboard, bike, etc. It can be physical or logical.
Class:-
Collection of objects is called class. It is a logical entity. A class can also be defined as a blueprint
from which you can create an individual object. Class doesn't consume any space.
Inheritance:-
When one object acquires all the properties and behaviors of a parent object, it is known as
inheritance. It provides code reusability. It is used to achieve runtime polymorphism.
Polymorphism:-
If one task is performed in different ways, it is known as polymorphism. For example: to convince the
customer differently, to draw something, for example, shape, triangle, rectangle, etc.
In Java, we use method overloading and method overriding to achieve polymorphism.
Abstraction:-
Hiding internal details and showing functionality is known as abstraction. For example phone call, we don t
know the internal processing.
Encapsulation:-
Binding (or wrapping) code and data together into a single unit are known as encapsulation. For
example, a capsule, it is wrapped with different medicines. A java class is the example of encapsulation.
Java bean is the fully encapsulated class because all the data members are private here.
Source Code:
class aa { String name; int roll;
public void aa_method() { name = "Manikant Verma";
roll = 1001; [Link](name); [Link](roll);
}
}
class pp extends aa {
int arr[] = {100, 50, 4, 2, 3};
public void pp_method() { roll = 1022;
[Link](roll);
16
for (int i = 0; i < [Link]; i++) { [Link](arr[i]);
}
}
}
class bb {
public static void main(String args[]) { aa obj = new aa();
obj.aa_method();
pp obj2 = new pp();
obj2.pp_method();
}
}
class student { String name;
int roll_no;
public void stu_method(String aa, int r1) { name = aa;
roll_no = r1;
}
}
class method
{
public static void main(String args[]) { student ss = new student();
[Link] = "Manikant Verma";
ss.roll_no = 1334; [Link]([Link]); [Link](ss.roll_no); ss.stu_method("Ancc", 10);
[Link]([Link]);
[Link](ss.roll_no);
}
}
17
18
EXPERIMENT NO. -4
AIM: Create Java programs using inheritance and polymorphism.
Procedure:
Inheritence is an important feature of object-oriented programming in Java. It allows for one class (child
class) to inherit the fields and methods of another class (parent class). For instance, we might want a
child class Dog to inherent traits from a more general parent class Animal.
When defining a child class in Java, we use the keyword extends to inherit from a parent class.
Types of Inheritances:- 1.
Single Inheritance
1. Multilevel Inheritance
2. Hierarchical Inheritance
polymorphism
Polymorphism in Java refers to the ability of a method, object, or operator to take multiple forms. There
are two main types:
1. Compile-time Polymorphism (Method Overloading)
2. Runtime Polymorphism (Method Overriding)
Source Code:
1. Write a java program for single inheritance.
class ClassA { int a = 10;
public void classA_method1()
{
a++; ++a;
[Link](a);
}
public void
19
classA_met
hod2() { a-
-;
--a;
[Link](a);
}
}
class ClassB
extends ClassA
{ public void
classB_method()
{
[Link]("I am a student of [Link] cse branch");
}
}
class ClassMain {
public static void
main(String args[]) { ClassB
obj = new ClassB();
obj.classA_method1();
obj.classA_method2();
obj.classB_method();
}
}
20
21
22