SlideShare a Scribd company logo
12/5/19
Introducing Java OOP concepts
& solving OOP problems
Ivelin Yanev
12/5/19
OUTLINE
1.Object and class
2.Abstraction
3.Inheritance
4.Polymorphism
5.Encapsulation
2
12/5/19
What is Class?
A class is an entity that determines how an object will behave and what the
object will contain. In other words, it is a blueprint or a set of instruction to build a
specific type of object {exam_1}.
3
class <class_name>{
private field1;
public field2;
protected field3;
private method1() {
}
public method1() {
}
protected method1() {
}
}
Syntax Access modifiers
12/5/19
What is an Object?
An object is nothing but a self-contained component which consists of methods
and properties to make a particular type of data useful. Object determines the
behavior of the class{exam_2}.
4
student1
student2
Stack
name = Ivan
age=23
name = Nikola
age=34
Heap
12/5/19
Abstraction
Abstraction is the mechanism to hiding the unnecessary things from the users
and provide only functionality {exam_3}.
5
There is a two way to achieve Abstraction:
1. By Abstract Class  - Through “abstract” keyword, we can declare a class is abstract. The
abstract class cannot be instantiated.
2. By Interface  - In an interface, each method is public and abstract, but it does not contain
any constructor.
@An abstract method is a method that is declared without an implementation!
12/5/19
Abstraction
6
12/5/19
Inheritance
When properties of one class inherited by other class, this concept is known as
Inheritance. The concept of inheritance provides code reusability feature. When
a class inherits the properties is known as a child class whereas a class whose
properties are inherited is known as Parent class {exam_4}.
7
There are 4 different types of inheritance which is supported by Java:
1.Single Inheritance:
Class A
Class B
12/5/19
Inheritance
8
2. Multilevel Inheritance:
Class B
Class A
Class C
12/5/19
Inheritance
3. Hierarchical Inheritance
9
Class B
Class A
Class C
12/5/19
Inheritance
10
Class BClass A
Class C
4. Multiple Inheritance
Class B
12/5/19
Polymorphism
Polymorphism is the concept which has the ability of an object to take on many
forms. Polymorphism a concept by which we can perform a single action by with
different behaviors {exam_5}.
Polymorphism in Java is of two types:
1. Run time polymorphism (static binding or method overloading)
2. Compile time polymorphism (dynamic binding or method overriding)
11
12/5/19
Compile Time Polymorphism (static binding or method
overloading)
As the meaning is implicit, this is used to write the program in such a way, that
flow of control is decided in compile time itself. It is achieved using method
overloading. In method overloading, an object can have two or more methods
with same name, BUT, with their method parameters different. These
parameters may be different on two bases
12
public static double Math.max(double a, double b){..}
public static float Math.max(float a, float b){..}
public static int Math.max(int a, int b){..}
public static long Math.max(long a, long b){..}
12/5/19
Runtime Polymorphism (dynamic binding or method
overriding)
Method overriding is a feature which you get when you implement inheritance in
your program {exam_6}.
13
12/5/19
Runtime Polymorphism (dynamic binding or method
overriding)
14
a0 a1 a2
makeNoise() makeNoise() makeNoise()
makeNoise() makeNoise()
Copy of
Animal
Copy of
Animal
Animal object Cat object Dog object
The reference identity of an object can
be stored in any number of reference
variables.
12/5/19
Encapsulation
Encapsulation is a mechanism of binding code and data together in a single unit.
15
12/5/19
Questions
1. Make a class Car. Make several(at least 4) subtypes of Car, representing the different brands of
cars - Audi, BMW, Wolkswagen.
2. Make a class Time to hold information about the current time and the current date . Make an easy-
to-use constructor (from client perspective), that would represent the time and date the client
wants to hold in your class.
3. Create a friendly interactive calculator in java Bundle, execute and test your program as a jar file
4. Create a PhoneBook class that stores names and phone numbers and allows the operations of
look-up, insertion and deletion. For each new class that you've created above, create an interface
that defines its behavior, then require your class to implement it.
Bonus points: JavaDoc & good git practice
https://dev.liferay.com/en/participate/advanced-javadoc-guidelines
https://www.git-tower.com/learn/git/ebook/en/command-line/appendix/best-practices
16

More Related Content

PPTX
Presentation on java (8)
PPTX
Advanced Object-Oriented/SOLID Principles
ODP
Basic of Java
PPTX
Java Programming
PPT
Polymorphism in java, method overloading and method overriding
PPTX
Arrays in java
PPTX
Core java
PPTX
Core java complete ppt(note)
Presentation on java (8)
Advanced Object-Oriented/SOLID Principles
Basic of Java
Java Programming
Polymorphism in java, method overloading and method overriding
Arrays in java
Core java
Core java complete ppt(note)

What's hot (20)

PPTX
Introduction to JAVA
PPTX
Objective c slide I
PPTX
OOP Introduction with java programming language
PPTX
Concurrency in c#
PDF
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
PPTX
Introduction to java
PPTX
Polymorphism
PPTX
Training on Core java | PPT Presentation | Shravan Sanidhya
PPTX
Inheritance In C++ (Object Oriented Programming)
PPTX
Core java
PPTX
Object Oriented Programing JAVA presentaion
ODP
CORBA & RMI in java
PPT
Inheritance C#
PDF
Domain Modeling Made Functional (KanDDDinsky 2019)
PPTX
Optional in Java 8
PPT
Classes&amp;objects
PPT
Files in c++ ppt
PPSX
Introduction of java
PPT
Fundamentals of JAVA
PDF
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Introduction to JAVA
Objective c slide I
OOP Introduction with java programming language
Concurrency in c#
What Is Java | Java Tutorial | Java Programming | Learn Java | Edureka
Introduction to java
Polymorphism
Training on Core java | PPT Presentation | Shravan Sanidhya
Inheritance In C++ (Object Oriented Programming)
Core java
Object Oriented Programing JAVA presentaion
CORBA & RMI in java
Inheritance C#
Domain Modeling Made Functional (KanDDDinsky 2019)
Optional in Java 8
Classes&amp;objects
Files in c++ ppt
Introduction of java
Fundamentals of JAVA
Java Tutorial | Java Programming Tutorial | Java Basics | Java Training | Edu...
Ad

Similar to Introducing java oop concepts (20)

PPT
Core JAVA Training.ppt
PPTX
ITTutor Advanced Java (1).pptx
PPTX
OOP in Java Presentation.pptx
PDF
Top 10 java_oops_interview_questions
PPTX
Top 10 java oops interview questions
PDF
Top 10 java_oops_interview_questions
PDF
Top 10 java_oops_interview_questions
PDF
Top 10 java_oops_interview_questions
PPTX
Top 10 java oops interview questions
PPTX
Chapter 4
PPTX
Object Oriented Programming
PPTX
inheritance, Packages and Interfaces.pptx
PPTX
Spring andspringboot training
PPTX
Unit-V.pptx
PDF
Inheritance
PPTX
Object Oriented Programming
PPT
Object oriented vs. object based programming
PDF
Principles of Object Oriented Programming
PPTX
Java OOPS Concept
PPTX
Java and its concepts
Core JAVA Training.ppt
ITTutor Advanced Java (1).pptx
OOP in Java Presentation.pptx
Top 10 java_oops_interview_questions
Top 10 java oops interview questions
Top 10 java_oops_interview_questions
Top 10 java_oops_interview_questions
Top 10 java_oops_interview_questions
Top 10 java oops interview questions
Chapter 4
Object Oriented Programming
inheritance, Packages and Interfaces.pptx
Spring andspringboot training
Unit-V.pptx
Inheritance
Object Oriented Programming
Object oriented vs. object based programming
Principles of Object Oriented Programming
Java OOPS Concept
Java and its concepts
Ad

More from Ivelin Yanev (11)

PDF
Quarkus Extensions Turbocharge for Java Microservices.pdf
PDF
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
PDF
Project Loom
PPTX
Building flexible ETL pipelines with Apache Camel on Quarkus
PDF
Git collaboration
PDF
Java exeptions
PDF
Introducing generic types
PDF
Java features. Java 8, 9, 10, 11
PDF
Design principles
PDF
Java 9 modularity+
PDF
Intoduction Internet of Things
Quarkus Extensions Turbocharge for Java Microservices.pdf
Empowering Your Java Applications with Quarkus. A New Era of Fast, Efficient,...
Project Loom
Building flexible ETL pipelines with Apache Camel on Quarkus
Git collaboration
Java exeptions
Introducing generic types
Java features. Java 8, 9, 10, 11
Design principles
Java 9 modularity+
Intoduction Internet of Things

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Nekopoi APK 2025 free lastest update
PPTX
Introduction to Artificial Intelligence
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
assetexplorer- product-overview - presentation
PPTX
CHAPTER 2 - PM Management and IT Context
PPT
Introduction Database Management System for Course Database
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
top salesforce developer skills in 2025.pdf
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Which alternative to Crystal Reports is best for small or large businesses.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Nekopoi APK 2025 free lastest update
Introduction to Artificial Intelligence
Odoo Companies in India – Driving Business Transformation.pdf
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Softaken Excel to vCard Converter Software.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
How to Migrate SBCGlobal Email to Yahoo Easily
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
assetexplorer- product-overview - presentation
CHAPTER 2 - PM Management and IT Context
Introduction Database Management System for Course Database
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

Introducing java oop concepts

  • 1. 12/5/19 Introducing Java OOP concepts & solving OOP problems Ivelin Yanev
  • 3. 12/5/19 What is Class? A class is an entity that determines how an object will behave and what the object will contain. In other words, it is a blueprint or a set of instruction to build a specific type of object {exam_1}. 3 class <class_name>{ private field1; public field2; protected field3; private method1() { } public method1() { } protected method1() { } } Syntax Access modifiers
  • 4. 12/5/19 What is an Object? An object is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. Object determines the behavior of the class{exam_2}. 4 student1 student2 Stack name = Ivan age=23 name = Nikola age=34 Heap
  • 5. 12/5/19 Abstraction Abstraction is the mechanism to hiding the unnecessary things from the users and provide only functionality {exam_3}. 5 There is a two way to achieve Abstraction: 1. By Abstract Class  - Through “abstract” keyword, we can declare a class is abstract. The abstract class cannot be instantiated. 2. By Interface  - In an interface, each method is public and abstract, but it does not contain any constructor. @An abstract method is a method that is declared without an implementation!
  • 7. 12/5/19 Inheritance When properties of one class inherited by other class, this concept is known as Inheritance. The concept of inheritance provides code reusability feature. When a class inherits the properties is known as a child class whereas a class whose properties are inherited is known as Parent class {exam_4}. 7 There are 4 different types of inheritance which is supported by Java: 1.Single Inheritance: Class A Class B
  • 10. 12/5/19 Inheritance 10 Class BClass A Class C 4. Multiple Inheritance Class B
  • 11. 12/5/19 Polymorphism Polymorphism is the concept which has the ability of an object to take on many forms. Polymorphism a concept by which we can perform a single action by with different behaviors {exam_5}. Polymorphism in Java is of two types: 1. Run time polymorphism (static binding or method overloading) 2. Compile time polymorphism (dynamic binding or method overriding) 11
  • 12. 12/5/19 Compile Time Polymorphism (static binding or method overloading) As the meaning is implicit, this is used to write the program in such a way, that flow of control is decided in compile time itself. It is achieved using method overloading. In method overloading, an object can have two or more methods with same name, BUT, with their method parameters different. These parameters may be different on two bases 12 public static double Math.max(double a, double b){..} public static float Math.max(float a, float b){..} public static int Math.max(int a, int b){..} public static long Math.max(long a, long b){..}
  • 13. 12/5/19 Runtime Polymorphism (dynamic binding or method overriding) Method overriding is a feature which you get when you implement inheritance in your program {exam_6}. 13
  • 14. 12/5/19 Runtime Polymorphism (dynamic binding or method overriding) 14 a0 a1 a2 makeNoise() makeNoise() makeNoise() makeNoise() makeNoise() Copy of Animal Copy of Animal Animal object Cat object Dog object The reference identity of an object can be stored in any number of reference variables.
  • 15. 12/5/19 Encapsulation Encapsulation is a mechanism of binding code and data together in a single unit. 15
  • 16. 12/5/19 Questions 1. Make a class Car. Make several(at least 4) subtypes of Car, representing the different brands of cars - Audi, BMW, Wolkswagen. 2. Make a class Time to hold information about the current time and the current date . Make an easy- to-use constructor (from client perspective), that would represent the time and date the client wants to hold in your class. 3. Create a friendly interactive calculator in java Bundle, execute and test your program as a jar file 4. Create a PhoneBook class that stores names and phone numbers and allows the operations of look-up, insertion and deletion. For each new class that you've created above, create an interface that defines its behavior, then require your class to implement it. Bonus points: JavaDoc & good git practice https://dev.liferay.com/en/participate/advanced-javadoc-guidelines https://www.git-tower.com/learn/git/ebook/en/command-line/appendix/best-practices 16