3. A Society ( Group of families)
Everything in the World is an Object (Society,
Family, Human, Cat, Dog, Car, River)
A society is a group of families.
Families are collections of Family member.
Each Family member is Human or Non Human.
Each family member has some responsibilities
(Activity) and they have their own properties.
Family members are interconnected to each
other.
4. A Society ( Group of families)
Each member is a human or non human.
Human beings are persons.
Each Human has common behavior comes
from Animal.
Each family member uses their guardians
vehicle or their own.
Each and every Human being has their own
Address.
5. Humans(Objects) Behavior
Object is an entity which has
State: determined by the values of its
properties.
Behavior: determined by how an object
performs an activity.
6. Humans(Objects) Properties &
Behavior/Activity
Every human(Male / Female / Other) has
common properties and also they have their
Behavior.
Properties: Name, Head, Hands, Hair,
Eyes(color , size), Nose, Address.
Behavior: Walking, Running, Playing, Gaining
Knowledge, Talking.
8. Java Class or Java Bean
A simple Object instance container.
It has some properties and behavior.
So we can map our real world objects through
Java .
Properties: nationalId,
name, Address,
vehicle, PassportInfo,
Occupation
Behavior: Walking,
Running, Shopping,
Talking, Cycling,Driving
9. Access Modifier in java for
properties and behavior
Public:
A declaration that is accessible to all classes
with keyword “public”
Private:
A declaration that is accessible only to the class
in which it is declared with “private”.
11. Java OOP feature(Abstraction)
Customer should
know to buy something
BillingStaff should
know products pricing
and to generate bill.
Administrator should
product sell and to buy
new products to gain
business goal and to
manage everything in
ABSTRACTION: concept of identifying the essential details to be
known and ignoring the non-essential details from the perspective
of the end user.
Retail Shop Scenario
13. Encapsulation
The Student don’t have to know the calculation
mechanism of Calculator.
He/she just know its use of button.
ENCAPSULATION: concept of hiding the internal
details and providing a simple interface to the end
user which ensures that the system can be used
without having to know how it works.
15. Inheritance
Each Human have some common behavior of
Animal.
Every family members are human or non-
human(Cat or dog).
Each Regular or Privileged Customer have
common Properties.
19. Polymorphism
Let us revisit the payment activity in the retail shop
Paymlent of bill can be done in two modes
Cash(Calculation includes VAT)
totalAmount = purchaseAmount + VAT
Credit Card(Calculation includes processing charge and
VAT)
totalAmount = purchaseAmount + VAT+
processingCharge
POLYMORPHISM: concept which allows on
objecct/operation to behave differently in different
situations.
So ? Now it is payment(processingCharge) or
payment()?
20. Polymorphism
Polymorphism is the
capability of a method
to do different things
based on the object
that it is acting upon
Following concepts
demonstrate different
types of polymorphism
in java.
1) Method
Overloading
2) Method
21. Static Binding vs Dynamic
Binding
difference between static and dynamic
binding in Java.
Static binding happens at compile-time while
dynamic binding happens at runtime.
Binding of private, static and final methods
always happen at compile time since these
methods cannot be overridden. Binding of
overridden methods happen at runtime.
Java uses static binding for overloaded
methods and dynamic binding for overridden
methods.
23. Abstract class & abstract
Method
If you declare an abstract
method (discussed below)
in a class then you must
declare the class abstract
as well. you can’t have
abstract method in a non-
abstract class.
24. What is an interface
Interface looks like class but it is not a class. An
interface can have methods and variables just
like the class but the methods declared in
interface are by default abstract (only method
signature, no body). Also, the variables declared
in an interface are public, static & final by
default.
** java programming language does not
support multiple inheritance (we can do this
through Interface)
25. Interface and abstract
Interface provides complete abstraction as
none of its methods can have body. On the other
hand, abstract class provides partial
abstraction as it can have abstract and
concrete(methods with body) methods both.
31. A Strong Tool : Collection Framework
To work with data in the local machine or
memory must use the collection framework.
Collections--> Set, List, ArrayList, Map,
LinkedHashMap