SlideShare a Scribd company logo
Oops in java
Date:06/01/2015
manutharunamuri@gmail.com
facebook.com/Manu-Kannan
twitter.com/baabtra
in.linkedin.com/in/baabtra
OOPs concepts in Java
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
-Bicycle’s states or properties: name, color, model
-Bicycle’s behaviors or action : riding, changing gears
● 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.
OOP FEATURES
● Abstraction
● Encapsulation
● Polymorphism
● Overriding
● Inheritance
● Interfaces
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));
}
}
Method Overriding
● We have two classes and both classes have a function
with the same name and same Parameters inheritance is
necessary.
● For Example
class B
{
public void f1(int x,int y)
{
System.out.println(x+y);
}
}
class A extends B
{
public void f1(int x,int y)
{
System.out.println(x*y);
}
public static void main(String ar[])
{
A a=new A();
a.f1(5,5);
B b=new B();
b.f1(2,3);
}
}
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(int x,int y)
{
Return x*y;
}
Public class dimensionshape extends shape
{
Private int depth;
Int calculateVolume()
{
Return width*height*depth;
}
Interface
● An interface is a collection of abstract methods (it means
all methods are only declared in an Interface).
● A class implements an interface, thereby inheriting the
abstract methods of the interface.
● And that class implements interface then you need to
defined all abstract function which is present in an
Interface.
● An interface is not a class.
● Writing an interface is similar to writing a class, but they
are two different concepts.
● A class describes the attributes and behaviors of an object
and interface contains behaviors that a class implements.
Example
interface Idemo
{
public void findSquare(int x);
}
class Demo implements Idemo
{
public void findSquare (int x)
{
System.out.println ("Square is "+(x*x));
}
public static void main (String ar[])
{
Demo dm=new Demo ();
dm.findSquare (10);
}
}
➸THANK YOU☺
US UK UAE
7002 Hana Road,
Edison NJ 08817,
United States of America.
90 High Street,
Cherry Hinton,
Cambridge, CB1 9HZ,
United Kingdom.
Suite No: 51, Oasis Center,
Sheikh Zayed Road, Dubai,
UAE
Email to info@baabtra.com or Visit baabtra.com
Looking for learning more about the above
topic?
India Centres
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
Cafit Square IT Park,
Hilite Business Park,
Kozhikode
Kerala, India.
Email: info@baabtra.com
TBI - NITC
NIT Campus, Kozhikode.
Kerala, India.
Start up Village
Eranakulam,
Kerala, India.
Start up Village
UL CC
Kozhikode, Kerala
Follow us @ twitter.com/baabtra
Like us @ facebook.com/baabtra
Subscribe to us @ youtube.com/baabtra
Become a follower @ slideshare.net/BaabtraMentoringPartner
Connect to us @ in.linkedin.com/in/baabtra
Give a feedback @ massbaab.com/baabtra
Thanks in advance
www.baabtra.com | www.massbaab.com |www.baabte.com
Want to learn more about programming or Looking to become a good programmer?
Are you wasting time on searching so many contents online?
Do you want to learn things quickly?
Tired of spending huge amount of money to become a Software professional?
Do an online course
@ baabtra.com
We put industry standards to practice. Our structured, activity based courses are so designed
to make a quick, good software professional out of anybody who holds a passion for coding.

More Related Content

What's hot (20)

PDF
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
PPT
Jsp ppt
Vikas Jagtap
 
PPTX
Jdbc ppt
sandeep54552
 
PPTX
classes and objects in C++
HalaiHansaika
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PPT
Introduction to c#
OpenSource Technologies Pvt. Ltd.
 
PPTX
Java string handling
Salman Khan
 
PPTX
Introduction to oop
colleges
 
PPT
Java interfaces
Raja Sekhar
 
PPTX
Constructor in java
Madishetty Prathibha
 
PPTX
OOPs in Java
Ranjith Sekar
 
PDF
C++ OOPS Concept
Boopathi K
 
PPTX
OOP Introduction with java programming language
Md.Al-imran Roton
 
PPTX
Inheritance and Interfaces
NAGASURESH MANOHARAN
 
PPTX
Methods in java
chauhankapil
 
PPTX
Java awt (abstract window toolkit)
Elizabeth alexander
 
PPTX
Java Tokens
Madishetty Prathibha
 
PPTX
Regular expressions in Python
Sujith Kumar
 
PPT
JAVA OOP
Sunil OS
 
PPTX
Arrays in java
Arzath Areeff
 
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Jsp ppt
Vikas Jagtap
 
Jdbc ppt
sandeep54552
 
classes and objects in C++
HalaiHansaika
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Java string handling
Salman Khan
 
Introduction to oop
colleges
 
Java interfaces
Raja Sekhar
 
Constructor in java
Madishetty Prathibha
 
OOPs in Java
Ranjith Sekar
 
C++ OOPS Concept
Boopathi K
 
OOP Introduction with java programming language
Md.Al-imran Roton
 
Inheritance and Interfaces
NAGASURESH MANOHARAN
 
Methods in java
chauhankapil
 
Java awt (abstract window toolkit)
Elizabeth alexander
 
Regular expressions in Python
Sujith Kumar
 
JAVA OOP
Sunil OS
 
Arrays in java
Arzath Areeff
 

Similar to Oops in java (20)

PPT
07slide.ppt
NuurAxmed2
 
PDF
Object Oriented Programming Constructors & Destructors
anitashinde33
 
PPTX
OOP_in_CPP_Animesh_Animated_Diagram.pptx
animesh713331
 
PPT
01-introductionto Object ooriented Programming in JAVA CS.ppt
GESISLAMIAPATTOKI
 
PPTX
classes object fgfhdfgfdgfgfgfgfdoop.pptx
arjun431527
 
PPT
Oop java
Minal Maniar
 
PDF
OOPs Concepts - Android Programming
Purvik Rana
 
PPTX
Introduction to OOPs second year cse.pptx
solemanhldr
 
PDF
Object Oriented Programming
sharmisivarajah
 
PDF
Object Oriented Programming notes provided
dummydoona
 
PPTX
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
Sagar Verma
 
PPT
Concepts In Object Oriented Programming Languages
ppd1961
 
PPTX
Ch.1 oop introduction, classes and objects
ITNet
 
PDF
Lecture2.pdf
SakhilejasonMsibi
 
PDF
Object Oriented Programming with C#
SyedUmairAli9
 
PPTX
Object oriented programming
MH Abid
 
PPTX
Object Oriented Programming in Python.pptx
grpvasundhara1993
 
PPTX
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
07slide.ppt
NuurAxmed2
 
Object Oriented Programming Constructors & Destructors
anitashinde33
 
OOP_in_CPP_Animesh_Animated_Diagram.pptx
animesh713331
 
01-introductionto Object ooriented Programming in JAVA CS.ppt
GESISLAMIAPATTOKI
 
classes object fgfhdfgfdgfgfgfgfdoop.pptx
arjun431527
 
Oop java
Minal Maniar
 
OOPs Concepts - Android Programming
Purvik Rana
 
Introduction to OOPs second year cse.pptx
solemanhldr
 
Object Oriented Programming
sharmisivarajah
 
Object Oriented Programming notes provided
dummydoona
 
OOPS in java | Super and this Keyword | Memory Management in java | pacakages...
Sagar Verma
 
Concepts In Object Oriented Programming Languages
ppd1961
 
Ch.1 oop introduction, classes and objects
ITNet
 
Lecture2.pdf
SakhilejasonMsibi
 
Object Oriented Programming with C#
SyedUmairAli9
 
Object oriented programming
MH Abid
 
Object Oriented Programming in Python.pptx
grpvasundhara1993
 
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
Ad

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
PDF
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 3 stored procedures
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Recently uploaded (20)

PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Workbook de Inglés Completo - English Path.pdf
shityouenglishpath
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PDF
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
PDF
epi editorial commitee meeting presentation
MIPLM
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PDF
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
PPTX
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Introduction presentation of the patentbutler tool
MIPLM
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Workbook de Inglés Completo - English Path.pdf
shityouenglishpath
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
How to Create a Customer From Website in Odoo 18.pptx
Celine George
 
Controller Request and Response in Odoo18
Celine George
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Horarios de distribución de agua en julio
pegazohn1978
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
IMPORTANT GUIDELINES FOR M.Sc.ZOOLOGY DISSERTATION
raviralanaresh2
 
epi editorial commitee meeting presentation
MIPLM
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
WATERSHED MANAGEMENT CASE STUDIES - ULUGURU MOUNTAINS AND ARVARI RIVERpdf
Ar.Asna
 
SD_GMRC5_Session 6AB_Dulog Pedagohikal at Pagtataya (1).pptx
NickeyArguelles
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Introduction presentation of the patentbutler tool
MIPLM
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 

Oops in java

  • 3. 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.
  • 4. What Are Objects? ● Software objects model reaL-world objects - dog, bicycle, etc. ● Real-world objects have states and behaviors -Bicycle’s states or properties: name, color, model -Bicycle’s behaviors or action : riding, changing gears ● 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
  • 5. 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.
  • 6. OOP FEATURES ● Abstraction ● Encapsulation ● Polymorphism ● Overriding ● Inheritance ● Interfaces
  • 7. 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.
  • 8. 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.
  • 9. 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.
  • 10. 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).
  • 11. 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)); } }
  • 12. Method Overriding ● We have two classes and both classes have a function with the same name and same Parameters inheritance is necessary. ● For Example class B { public void f1(int x,int y) { System.out.println(x+y); } }
  • 13. class A extends B { public void f1(int x,int y) { System.out.println(x*y); } public static void main(String ar[]) { A a=new A(); a.f1(5,5); B b=new B(); b.f1(2,3); } }
  • 14. 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 .
  • 15. Example Public class shape { protected int width; protected int height; Int calculateArea(int x,int y) { Return x*y; } Public class dimensionshape extends shape { Private int depth; Int calculateVolume() { Return width*height*depth; }
  • 16. Interface ● An interface is a collection of abstract methods (it means all methods are only declared in an Interface). ● A class implements an interface, thereby inheriting the abstract methods of the interface. ● And that class implements interface then you need to defined all abstract function which is present in an Interface. ● An interface is not a class. ● Writing an interface is similar to writing a class, but they are two different concepts. ● A class describes the attributes and behaviors of an object and interface contains behaviors that a class implements.
  • 17. Example interface Idemo { public void findSquare(int x); } class Demo implements Idemo { public void findSquare (int x) { System.out.println ("Square is "+(x*x)); } public static void main (String ar[]) { Demo dm=new Demo (); dm.findSquare (10); } }
  • 19. US UK UAE 7002 Hana Road, Edison NJ 08817, United States of America. 90 High Street, Cherry Hinton, Cambridge, CB1 9HZ, United Kingdom. Suite No: 51, Oasis Center, Sheikh Zayed Road, Dubai, UAE Email to [email protected] or Visit baabtra.com Looking for learning more about the above topic?
  • 20. India Centres 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 Cafit Square IT Park, Hilite Business Park, Kozhikode Kerala, India. Email: [email protected] TBI - NITC NIT Campus, Kozhikode. Kerala, India. Start up Village Eranakulam, Kerala, India. Start up Village UL CC Kozhikode, Kerala
  • 21. Follow us @ twitter.com/baabtra Like us @ facebook.com/baabtra Subscribe to us @ youtube.com/baabtra Become a follower @ slideshare.net/BaabtraMentoringPartner Connect to us @ in.linkedin.com/in/baabtra Give a feedback @ massbaab.com/baabtra Thanks in advance www.baabtra.com | www.massbaab.com |www.baabte.com
  • 22. Want to learn more about programming or Looking to become a good programmer? Are you wasting time on searching so many contents online? Do you want to learn things quickly? Tired of spending huge amount of money to become a Software professional? Do an online course @ baabtra.com We put industry standards to practice. Our structured, activity based courses are so designed to make a quick, good software professional out of anybody who holds a passion for coding.