UNIVERSITY INSTITUTE COMPUTING
BSc (CS)/ BCA
Subject Name: Java Programming
Code: 22SCT-351/22CAT-351
JAVA PROGRAMMING DISCOVER . LEARN . EMPOWER
1
Syllabus
Unit-I
Principles of Object-Oriented Programming
• Introduction: Introduction to Java, Basic Features, JVM Concepts, A Simple Java
Program, Primitive Data Type and Variables, Java Keywords,.
2
Content
(Unit I)
Principles of Object-Oriented Programming
Chapter 1.1:
Lecture1.1.2-
1. OOPS Concept
2. C++ versus Java
3. JDK
3
Objectives/Outcomes
CO1: Identify the ways to implement the inheritance concept in
the Java programming language.
4
Programming languages
Fig 1: Programming languages[1].
5
Object Oriented Programming
• Object-oriented programming (OOP) is at the core of Java
• All computer programs consist of two elements: code and data.
• These are the two paradigms that govern how a program is constructed. The first way
is called the process-oriented model. This approach characterizes a program as a
series of linear steps (that is, code). The process-oriented model can be thought of as
code acting on data.
6
Object Oriented Programming Contd.
.
• Procedural languages such as C employ this model to considerable success
• To manage increasing complexity, the second approach, called object-oriented
programming, was conceived. Object-oriented programming organizes a program
around its data (that is, objects) and a set of well-defined interfaces to that data. An
object-oriented program can be characterized as data controlling access to code.
7
Abstraction
• An essential element of object-oriented programming is abstraction.
• Humans manage complexity through abstraction. For example, people do not think
of a car as a set of tens of thousands of individual parts. They think of it as a well-
defined object with its own unique behavior.
• Data Abstraction is the property by virtue of which only the essential details are
displayed to the user.
• In java, abstraction is achieved by interfaces and abstract classes. We can achieve
100% abstraction using interfaces.
8
Encapsulation
• Encapsulation is the mechanism that binds together code and the data it manipulates,
and keeps both safe from outside interference and misuse.
• One way to think about encapsulation is as a protective wrapper that prevents the
code and data from being arbitrarily accessed by other code defined outside the
wrapper.
Fig 2: Encapsulation[2]
9
Encapsulation Example
Fig 3: Encapsulation Example[3]
10
Inheritance
• Inheritance is the process by which one object acquires the properties of another
object.
• This is important because it supports the concept of hierarchical classification.
Fig 4: Inheritance[4]
11
Inheritance Example
Fig 5: Inheritance Example[5]
12
Polymorphism
• Polymorphism (from Greek, meaning “many forms”) is a feature that allows one
interface to be used for a general class of actions.
• Polymorphism in Java is a concept by which we can perform a single action in
different ways.
• There are two types of polymorphism in Java: compile-time polymorphism and
runtime polymorphism. We can perform polymorphism in java by method
overloading and method overriding.
13
Polymorphism Example
Fig 6: Polymorphism Example[6]
14
C++ versus Java
Fig 7: C++ Versus java[7]
15
JDK (Java Development Kit)
16
JDK (Java Development Kit)
17
JDK (Java Development Kit)
18
JDK (Java Development Kit)
19
JDK (Java Development Kit)
20
Permanent Path of JDK in Windows
21
Setting Environment Variables
22
Setting Environment Variables
23
Setting Environment Variables
24
Temporary path of JDK in Windows
25
References
• Fig 1: https://www.digimat.in/nptel/courses/video/106105191/L01.html
• Fig 2: https://www.digimat.in/nptel/courses/video/106105191/L01.html
• Fig 3: https://www.digimat.in/nptel/courses/video/106105191/L01.html
• Fig 4: https://www.javatpoint.com/inheritance-in-java
• Fig 5: https://www.digimat.in/nptel/courses/video/106105191/L01.html
• Fig 6:https://www.digimat.in/nptel/courses/video/106105191/L01.html
• Fig 7: https://www.digimat.in/nptel/courses/video/106105191/L01.html
26
References
• https://www.tutorialspoint.com/java/java_abstraction.htm
• https://www.tutorialspoint.com/java/java_encapsulation.htm
• https://www.tutorialspoint.com/java/java_inheritance.htm
• https://www.tutorialspoint.com/java/java_polymorphism.htm
• https://www.javatpoint.com/how-to-set-path-in-java
• https://www.java.com/en/download/help/path.xml
27
THANK YOU