Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Typing Speed
Week Target Achieved
1 25WPM 18WPM
2 25WPM 19WPM
3 25WPM 20WPM
4 25WPM 21WPM
5 25wpm 21wpm
6 25wpm 21wpm
7 25wpm 22wpm
8 25wpm 22wpm
9 25wpm 23wpm
10 25wpm 23wpm
Object-Oriented Programming
MEENU SOMAN.P
meenusoman99@gmail.com
www.facebook.com/MEENU
SOMAN
twitter.com/username
in.linkedin.com/in/profilena
me
8943031867
What is OOP?
 Object-oriented programming (OOP)style of programming that
focuses on using objects to design and build applications.
 Think of an object as a model of the concepts,processes, or thing
in the real world that are meaningful to your application
What Are Objects?
 Software objects model reaL-world objects
- dog, bicycle, etc.
 Real-world objects have states and behaviors
-Dogs' states or properties: name, color, breed, hungry
-Dogs' behaviors or action : barking fetching
 How do Software objects implement real-world objects?
-Use variables to implement states
-Use methods to implement behaviors
 An object is a software bundle of variables and related
methods
Definition
• Class : -is the base design of objects
• Object :- is the instance of a class
• No memory is allocated when a class is created.
• Memory is allocated only when an object is created.
Constructor
 A method in a class that initialize an instance of an object
before it's used.
• The same name as the class and have no return type
 Multiple Constructors: the same name but a different number
of arguments or different typed arguments
• Method Overloading
 Java Provides default constructors.
 The special variable, this, can be used inside a method to refer
to the object instance
Example for Constructor
• Public class shape
{
private int width;
private int height;
shape(int height,int width)
{
this.width=width;
this.height=height;
}
Private int calculateArea()
{
return a*b;
}
}
Shape rectangle=new shape(20,35);
OOP FEATURES
Abstraction
Encapsulation
Polymorphism
Inheritance
Data Abstraction
 Abstraction refers to the act of representing
essential features without including the
background details or explanations.
 Since the classes use the concept of data
abstraction , they are known as the abstract
data types.
Encapsulation
 The wrapping up of data and functions into a
single unit is known as Encapsulation.
 The data is not accessible to the outside world
and only those functions which are wrapped in
the class can access it.
 This insulation of the data from direct access by
the program is called Data hiding or information
hiding.
Polymorphism
 In polymorphism refers to a programming language 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).
Example
Public class shape
{
int calculateArea(int width,int height)
{
return width*height;
}
float calculateArea(int radius)
{
return(22/7)*radius*radius;
}
}
public class example
{
Public static void main(string args[])
{
Shape sh=new shape();
System.out.println(sh.calculateArea(10));
}
}
Inheritance
 In object-oriented programming, inheritance is the
concept that when a class of objects is define, any subclass
that is defined can inherit the definitions of one or more
general classes.
 This means for the programmer that an object in a subclass
need not carry its own definition of data and methods that
are generic to the class (or classes) of which it is a part.
 This not only speeds up program development; it also
ensures an inherent validity to the defined subclass object
Example
Public class shape
{
protected int width;
protected int height;
Int calculateArea()
{
Return x*y;
}
Public class dimensionshape extends shape
{
Private int depth;
Int calculateVolume()
{
Return width*height*depth;
}
}
End
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550
Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com
IKK Road,
East Hill, Kozhikode
Kerala, India.
Ph: + 91 – 495 30 63 624
NIT-TBI,
NIT Campus, Kozhikode,
Kerala, India.

OOP in java

  • 2.
    Disclaimer: This presentationis prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 4.
    Typing Speed Week TargetAchieved 1 25WPM 18WPM 2 25WPM 19WPM 3 25WPM 20WPM 4 25WPM 21WPM 5 25wpm 21wpm 6 25wpm 21wpm 7 25wpm 22wpm 8 25wpm 22wpm 9 25wpm 23wpm 10 25wpm 23wpm
  • 5.
  • 6.
    What is OOP? Object-oriented programming (OOP)style of programming that focuses on using objects to design and build applications.  Think of an object as a model of the concepts,processes, or thing in the real world that are meaningful to your application
  • 7.
    What Are Objects? Software objects model reaL-world objects - dog, bicycle, etc.  Real-world objects have states and behaviors -Dogs' states or properties: name, color, breed, hungry -Dogs' behaviors or action : barking fetching  How do Software objects implement real-world objects? -Use variables to implement states -Use methods to implement behaviors  An object is a software bundle of variables and related methods
  • 8.
    Definition • Class :-is the base design of objects • Object :- is the instance of a class • No memory is allocated when a class is created. • Memory is allocated only when an object is created.
  • 9.
    Constructor  A methodin a class that initialize an instance of an object before it's used. • The same name as the class and have no return type  Multiple Constructors: the same name but a different number of arguments or different typed arguments • Method Overloading  Java Provides default constructors.  The special variable, this, can be used inside a method to refer to the object instance
  • 10.
    Example for Constructor •Public class shape { private int width; private int height; shape(int height,int width) { this.width=width; this.height=height; } Private int calculateArea() { return a*b; } } Shape rectangle=new shape(20,35);
  • 11.
  • 12.
    Data Abstraction  Abstractionrefers to the act of representing essential features without including the background details or explanations.  Since the classes use the concept of data abstraction , they are known as the abstract data types.
  • 13.
    Encapsulation  The wrappingup of data and functions into a single unit is known as Encapsulation.  The data is not accessible to the outside world and only those functions which are wrapped in the class can access it.  This insulation of the data from direct access by the program is called Data hiding or information hiding.
  • 14.
    Polymorphism  In polymorphismrefers to a programming language 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).
  • 15.
    Example Public class shape { intcalculateArea(int width,int height) { return width*height; } float calculateArea(int radius) { return(22/7)*radius*radius; } } public class example { Public static void main(string args[]) { Shape sh=new shape(); System.out.println(sh.calculateArea(10)); } }
  • 16.
    Inheritance  In object-orientedprogramming, inheritance is the concept that when a class of objects is define, any subclass that is defined can inherit the definitions of one or more general classes.  This means for the programmer that an object in a subclass need not carry its own definition of data and methods that are generic to the class (or classes) of which it is a part.  This not only speeds up program development; it also ensures an inherent validity to the defined subclass object
  • 17.
    Example Public class shape { protectedint width; protected int height; Int calculateArea() { Return x*y; } Public class dimensionshape extends shape { Private int depth; Int calculateVolume() { Return width*height*depth; } }
  • 18.
  • 19.
    If this presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 20.
    Contact Us Emarald Mall(Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: info@baabtra.com IKK Road, East Hill, Kozhikode Kerala, India. Ph: + 91 – 495 30 63 624 NIT-TBI, NIT Campus, Kozhikode, Kerala, India.