2. Why OOP?
• Traditional Procedural-Oriented languages
– difficult to copy a function from one program and
reuse in another program because the the
function is reference the headers, global variables
and other functions.
(i.e. not well-encapsulated
as a self-contained reusable unit.)
– not suitable of high-level
abstraction for solving
real life problems.
3. Why OOP?
• Object-oriented programming (OOP)
languages
– class, which encapsulates both the static
attributes and dynamic behaviors (i.e. well-
encapsulated, easier to reuse)
– permit higher level of
abstraction for solving
real-life problems
4. Benefits of OOP
• Ease in software design
• Ease in software maintenance
• Reusable software
5. What is JAVA?
• programming language expressly designed for
use in the distributed environment of the
Internet
• Simple, Secure, Robust, Complete Object
Oriented and Platform Independent High level
Language.
• It is portable and Multi-thread technology
gives High performance.
9. Object
• real word entity that has state and behavior
• contains data (instance variables)
representing its state, and instance methods,
which are the things it can do.
• instance of a class
10. Class
• Collection of objects
• template, blueprint or contract that defines
what an object’s data fields and methods will
be.
11. Abstraction
• Hiding internal details and showing
functionality
• In java, we use abstract class and interface to
achieve abstraction.
13. Inheritance
• When one object acquires all the properties
and behaviors of parent object
• provides code reusability.
• Used to achieve runtime polymorphism.
16. Polymorphism
• same word or symbol to be interpreted
correctly in different situations based on the
context
• There are two types of polymorphism :
1.Compile-time polymorphism (Method
Overloading/Static)
2.Runtime Polymorphism (Method
Overriding/Dynamic)
17. Ploymorphism
Method Overloading:
having multiple methods with same name but
with different signature (number, type and
order of parameters).
Method Overriding:
When a subclass contains a method with the same
name and signature as in the super class then it is
called as method overriding.
18. Summery
• An object is an instance of a class.
• Using abstraction one can simulate real world objects.
• Abstraction provides advantage of code reuse
• Abstraction enables program open for extension
• Encapsulation provides the security that keeps data
and methods safe from inadvertent changes.
• Inheritance is parent-child relationship of class which is
mainly used for code reusability.
• Polymorphism definition is that Poly means many and
morphos means forms.