SREE NARAYANA GURU COLLEGE
DEPT. OF COMPUTER SCIENCE
I B.Sc Artificial Intelligence & Machine Learning [2023-2026]
JAVA PROGRAMMING
UNIT I
OBJECT-ORIENTED PARADIGM:
The term Programming paradigm means the methodology for writing program codes. In general,
two paradigms govern how you can construct a program. These two ways are:
1. a process-oriented model
2. an object-oriented model
Many programming languages support both the paradigms like python. Python allows the users to
code using both process-oriented and object-oriented methodologies. However, Java is exclusively
object-oriented.
The object-oriented programming paradigm
(OOP) has a completely different approach to problem-
solving. It does not focus on the problem that needs to be
solved but focuses on the objects that make up the system. We
can compare objects with real-life entities like a car or a dog,
and all these objects have a state and behaviour.
For example, a car state includes its name, colour, brand, and its behaviour includes moving,
slowing down, and changing gears.
Therefore, the goal of an object oriented paradigm is to represent the real world while writing
code.
GINESH.M | ASST. PROFESSOR | SNGC COLLEGE COIMBATORE pg. 1
, BASIC CONCEPTS OF OBJECT-ORIENTED PROGRAMMING:
It simplifies software development and maintenance by providing some
concepts:
o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation
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.
Object:
An object can be defined as an instance of a class, and there can be multiple instances of a class
in a program. An Object is one of the Java OOPs concepts which contains both the data and the
function, which operates on the data. For example – chair, bike, marker, pen, table, car, etc.
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.
Another example can be to speak something; For example, a cat speaks meow, dog barks woof,
etc.
Abstraction:
Hiding internal details and showing functionality is known as abstraction. For example phone
call, we don't know the internal processing. In Java, we use abstract class and interface to achieve
abstraction.
GINESH.M | ASST. PROFESSOR | SNGC COLLEGE COIMBATORE pg. 2
DEPT. OF COMPUTER SCIENCE
I B.Sc Artificial Intelligence & Machine Learning [2023-2026]
JAVA PROGRAMMING
UNIT I
OBJECT-ORIENTED PARADIGM:
The term Programming paradigm means the methodology for writing program codes. In general,
two paradigms govern how you can construct a program. These two ways are:
1. a process-oriented model
2. an object-oriented model
Many programming languages support both the paradigms like python. Python allows the users to
code using both process-oriented and object-oriented methodologies. However, Java is exclusively
object-oriented.
The object-oriented programming paradigm
(OOP) has a completely different approach to problem-
solving. It does not focus on the problem that needs to be
solved but focuses on the objects that make up the system. We
can compare objects with real-life entities like a car or a dog,
and all these objects have a state and behaviour.
For example, a car state includes its name, colour, brand, and its behaviour includes moving,
slowing down, and changing gears.
Therefore, the goal of an object oriented paradigm is to represent the real world while writing
code.
GINESH.M | ASST. PROFESSOR | SNGC COLLEGE COIMBATORE pg. 1
, BASIC CONCEPTS OF OBJECT-ORIENTED PROGRAMMING:
It simplifies software development and maintenance by providing some
concepts:
o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation
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.
Object:
An object can be defined as an instance of a class, and there can be multiple instances of a class
in a program. An Object is one of the Java OOPs concepts which contains both the data and the
function, which operates on the data. For example – chair, bike, marker, pen, table, car, etc.
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.
Another example can be to speak something; For example, a cat speaks meow, dog barks woof,
etc.
Abstraction:
Hiding internal details and showing functionality is known as abstraction. For example phone
call, we don't know the internal processing. In Java, we use abstract class and interface to achieve
abstraction.
GINESH.M | ASST. PROFESSOR | SNGC COLLEGE COIMBATORE pg. 2