What is
Object-Oriented Programming
 Any Idea ????
Definition
 Object-oriented programming (OOP) is a
programming paradigm using "objects" – data
structures consisting of data fields and methods
together with their interactions – to design
applications and computer programs. Programming
techniques may include features such as data
abstraction, encapsulation, messaging, modularity,
polymorphism, and inheritance
4 Pillars of OOPS
 Abstraction
 Polymorphism
 Inheritance
 Encapsulation
Abstraction
 Abstraction (from the Latin abs, meaning away from
and traction meaning to draw) is the process of taking
away or removing characteristics from something in
order to reduce it to a set of essential characteristics. In
object-oriented programming, abstraction is one of
three central principles (along with encapsulation and
inheritance). Through the process of abstraction, a
programmer hides all but the relevant data about an
object in order to reduce complexity and increase
efficiency. In the same way that abstractionomitted
Polymorphism
 polymorphism refers to a programming language's
ability to process objects differently depending on
their data type or class. More specifically, it is the
ability to redefine methods for derived classes. For
example, given a base class shape, polymorphism
enables the programmer to define different area
methods for any number of derived classes, such as
circles, rectangles and triangles. No matter what shape
an object is, applying the area method to it will return
the correct results. Polymorphism is considered to be a
requirement of any true object-oriented programming
language (OOPL).
Inheritance
 In object-oriented programming (OOP), inheritance
is a way to compartmentalize and reuse code by
creating collections of attributes and behaviors called
objects that can be based on previously created
objects. In classical inheritance where objects are
defined by classes, classes can inherit other classes.
The new classes, known as subclasses (or derived
classes), inherit attributes and behavior (i.e. previously
coded algorithms) of the pre-existing classes, which
are referred to as superclasses, ancestor classes or base
classes. The inheritance relationships of classes gives
rise to a hierarchy
Encapsulation
 Encapsulation means as much as shielding. Each
object-oriented object has a shield around it. Objects
can't 'see' each other. They can exchange things
though, as if they are interconnected through a hatch.
 shows the concept of the encapsulation. It separates
the external aspects of an object from the internal
implementation details of the object, which are
hidden from other objects. The object encapsulates
both data and the logical procedures required to
manipulate the data.
Encapsulation Example:
Classes
 In object-oriented programming, a class is a construct
that is used as a blueprint to create instances of itself –
referred to as class instances, class objects, instance
objects or simply objects. A class defines constituent
members which enable these class instances to have
state and behavior. Data field members (member
variables or instance variables) enable a class object to
maintain state. Other kinds of members, especially
methods, enable a class object's behavior
Class In Java
 Classes are the fundamental building blocks of a Java
program. You can define an Employee class as follows:
 class Employee {
int age;
double salary;
}
 By convention, class names capitalize the initial of
each word.
 For example: Employee, Boss, DateUtility, PostOffice,
RegularRateCalculator.
Continued
 This type of naming convention is known as Pascal
naming convention.
 The other convention, the camel naming convention,
capitalize the initial of each word, except the first
word.
 Method and field names use the camel naming
convention
Object
 An object doesn't exist until an instance of the class
has been created; the class is just a definition. When
the object is physically created, space for that object is
allocated in RAM. It is possible to have multiple
objects created from one class.
Access Control
In Java there are 4 types of access types
 1. Private .
 2. public .
 3. default (no type )
 4. protected .
◆ = CAN ACCESS ◇ = NO Access

Object oriented programming

  • 2.
  • 3.
    Definition  Object-oriented programming(OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance
  • 4.
    4 Pillars ofOOPS  Abstraction  Polymorphism  Inheritance  Encapsulation
  • 5.
    Abstraction  Abstraction (fromthe Latin abs, meaning away from and traction meaning to draw) is the process of taking away or removing characteristics from something in order to reduce it to a set of essential characteristics. In object-oriented programming, abstraction is one of three central principles (along with encapsulation and inheritance). Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. In the same way that abstractionomitted
  • 6.
    Polymorphism  polymorphism refersto a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. For example, given a base class shape, polymorphism enables the programmer to define different area methods for any number of derived classes, such as circles, rectangles and triangles. No matter what shape an object is, applying the area method to it will return the correct results. Polymorphism is considered to be a requirement of any true object-oriented programming language (OOPL).
  • 7.
    Inheritance  In object-orientedprogramming (OOP), inheritance is a way to compartmentalize and reuse code by creating collections of attributes and behaviors called objects that can be based on previously created objects. In classical inheritance where objects are defined by classes, classes can inherit other classes. The new classes, known as subclasses (or derived classes), inherit attributes and behavior (i.e. previously coded algorithms) of the pre-existing classes, which are referred to as superclasses, ancestor classes or base classes. The inheritance relationships of classes gives rise to a hierarchy
  • 8.
    Encapsulation  Encapsulation meansas much as shielding. Each object-oriented object has a shield around it. Objects can't 'see' each other. They can exchange things though, as if they are interconnected through a hatch.  shows the concept of the encapsulation. It separates the external aspects of an object from the internal implementation details of the object, which are hidden from other objects. The object encapsulates both data and the logical procedures required to manipulate the data.
  • 9.
  • 10.
    Classes  In object-orientedprogramming, a class is a construct that is used as a blueprint to create instances of itself – referred to as class instances, class objects, instance objects or simply objects. A class defines constituent members which enable these class instances to have state and behavior. Data field members (member variables or instance variables) enable a class object to maintain state. Other kinds of members, especially methods, enable a class object's behavior
  • 11.
    Class In Java Classes are the fundamental building blocks of a Java program. You can define an Employee class as follows:  class Employee { int age; double salary; }  By convention, class names capitalize the initial of each word.  For example: Employee, Boss, DateUtility, PostOffice, RegularRateCalculator.
  • 12.
    Continued  This typeof naming convention is known as Pascal naming convention.  The other convention, the camel naming convention, capitalize the initial of each word, except the first word.  Method and field names use the camel naming convention
  • 13.
    Object  An objectdoesn't exist until an instance of the class has been created; the class is just a definition. When the object is physically created, space for that object is allocated in RAM. It is possible to have multiple objects created from one class.
  • 14.
    Access Control In Javathere are 4 types of access types  1. Private .  2. public .  3. default (no type )  4. protected .
  • 15.
    ◆ = CANACCESS ◇ = NO Access