SlideShare a Scribd company logo
1 of 40
Dr. Avadhesh Kumar
Asst. Prof, SAS, VIT-AP
Object Oriented Programming
 Object-oriented programming (OOP) is a
computer programming model that organizes
software design around data, or objects,
rather than functions and logic. An object can
be defined as a data field that has unique
attributes and behavior.
 Every class has data field(data member) and
method(function).
 A Java object is an instance of a Java class.
Each object has an identity, a behavior and a
state.
 The state of an object is stored in fields
(variables), while methods (functions) display
the object's behavior. Objects are created at
runtime from templates, which are also
known as classes.
 A class is a template or blueprint from which
objects are created. So, an object is the
instance(result) of a class.
 Originally, object-oriented programming was
used most frequently for two major types of
applications:
 Computer simulations,
which attempt to mimic real-world activities
so that their processes can be improved or so
that users can better understand how the
real-world processes operate
 Graphical user interfaces, or GUIs
(pronounced “gooeys”), which allow users to
interact with a program in a graphical
environment
 To understand object-oriented programming
it requires grasping three basic concepts:
 1. Encapsulation
 2. Inheritance
 3. Polymorphism
 A method is a self-contained block of
program code that carries out some action,
similar to a procedure (function) in a
procedural program (C program).
 It is like a function in C program but it is
associated some class.
 For example, a Dog class might have
methods for walking, eating.
 In object-oriented classes, attributes and
methods are encapsulated into objects.
 Encapsulation is the enclosure of data and
methods within an object.
 Encapsulation allows you to treat all of an
object’s methods and data as a single entity.
Just as an actual dog contains all of its
attributes and abilities, so would a program’s
Dog object.
 Encapsulation also refers to the concealment
of an object’s data and methods from outside
sources.
 Concealing data is sometimes called
information hiding.
 Encapsulation lets you hide specific object
attributes and methods from outside sources
and provides the security that keeps data and
methods safe from inadvertent(undesired)
changes.
 An important feature of object-oriented program
design is inheritance—the ability to create
classes that share the attributes and methods of
existing classes, but with more specific features.
 For example, Automobile is a class, and all
Automobile objects share many traits and
abilities. Convertible is a class that inherits from
the Automobile class; a Convertible is a
type of Automobile that has and can do
everything a “plain” Automobile does—but with
an added ability
 A final important concept in object-oriented
terminology is polymorphism.
 Literally, polymorphism means “many
forms”—it describes the feature of languages
that allows the same word or symbol to be
interpreted correctly in different situations
based on the context.
 For example, although the classes
Automobile, Sailboat, and Airplane all inherit
from Vehicle, turn and stop methods work
differently for instances of those classes.
 It is a Java standard, although not a requirement, to begin
class identifiers with an uppercaseletter and employ other
uppercase letters as needed to improve readability.
 (By contrast, method identifiers, like println(), conventionally
begin with a lowercase letter.)
 The stylethat joins words in which each word begins with an
uppercase letter is called Pascal casing, or sometimes upper
camel casing. You should follow established conventions for
Java so
 your programs will be easy for other programmers to
interpret and follow.
 To create a Scanner object and connect it to the
System.in object, you write a statement similar to
the following:
 Scanner inputDevice = new Scanner(System.in);
 A main() method executes automatically when
you run a program, but other methods do not
execute simply because you place them
within a class—they must be called.
 The method header is the first line of a
method. It contains the following:
 Optional access specifiers
 A return type
 An identifier
 Parentheses
 It is a special type of method which is used to
initialize the object.
 Every time an object is created using the
new() keyword, at least one constructor is
called.
 It calls a default constructor if there is no
constructor available in the class. In such
case, Java compiler provides a default
constructor by default.
 Constructor name must be the same as its
class name
 There are two types of constructors in Java:
 1. Default constructor (no-arg constructor)
 2. Parameterized constructor
 The access modifiers in Java specifies the
accessibility or scope of a field, method,
constructor, or class.
 We can change the access level of fields,
constructors, methods, and class by applying
the access modifier on it.
 Private: The access level of a private modifier is only
within the class. It cannot be accessed from outside
the class.
 Default: The access level of a default modifier is only
within the package. It cannot be accessed from
outside the package. If you do not specify any access
level, it will be the default.
 Protected: The access level of a protected modifier is
within the package and outside the package through
child class. If you do not make the child class, it
cannot be accessed from outside the package.
 Public: The access level of a public modifier is
everywhere. It can be accessed from within the class,
outside the class, within the package and outside the
package
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx
FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx

More Related Content

Similar to FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx

Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
vamshimahi
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
Rich Helton
 

Similar to FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx (20)

Java interview questions and answers
Java interview questions and answersJava interview questions and answers
Java interview questions and answers
 
Java Interview Questions
Java Interview QuestionsJava Interview Questions
Java Interview Questions
 
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
Internet and Web Technology (CLASS-15) [JAVA Basics] | NIC/NIELIT Web Technol...
 
Abap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorialsAbap object-oriented-programming-tutorials
Abap object-oriented-programming-tutorials
 
Java notes
Java notesJava notes
Java notes
 
Object Oriented Javascript part2
Object Oriented Javascript part2Object Oriented Javascript part2
Object Oriented Javascript part2
 
Object oriented basics
Object oriented basicsObject oriented basics
Object oriented basics
 
Java chapter 3 - OOPs concepts
Java chapter 3 - OOPs conceptsJava chapter 3 - OOPs concepts
Java chapter 3 - OOPs concepts
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
Nitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptxNitish Chaulagai Java1.pptx
Nitish Chaulagai Java1.pptx
 
OOP in Java Presentation.pptx
OOP in Java Presentation.pptxOOP in Java Presentation.pptx
OOP in Java Presentation.pptx
 
Unit 1 Java
Unit 1 JavaUnit 1 Java
Unit 1 Java
 
Oops
OopsOops
Oops
 
JavaScript OOPS Implimentation
JavaScript OOPS ImplimentationJavaScript OOPS Implimentation
JavaScript OOPS Implimentation
 
Android Training (Java Review)
Android Training (Java Review)Android Training (Java Review)
Android Training (Java Review)
 
Java_presesntation.ppt
Java_presesntation.pptJava_presesntation.ppt
Java_presesntation.ppt
 
My c++
My c++My c++
My c++
 
Intro Java Rev010
Intro Java Rev010Intro Java Rev010
Intro Java Rev010
 
concept of oops
concept of oopsconcept of oops
concept of oops
 

Recently uploaded

Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
ZurliaSoop
 
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
nirzagarg
 
K Venkat Naveen Kumar | GCP Data Engineer | CV
K Venkat Naveen Kumar | GCP Data Engineer | CVK Venkat Naveen Kumar | GCP Data Engineer | CV
K Venkat Naveen Kumar | GCP Data Engineer | CV
K VENKAT NAVEEN KUMAR
 
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
gajnagarg
 
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
yulianti213969
 
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 

Recently uploaded (20)

DMER-AYUSH-MIMS-Staff-Nurse-_Selection-List-04-05-2024.pdf
DMER-AYUSH-MIMS-Staff-Nurse-_Selection-List-04-05-2024.pdfDMER-AYUSH-MIMS-Staff-Nurse-_Selection-List-04-05-2024.pdf
DMER-AYUSH-MIMS-Staff-Nurse-_Selection-List-04-05-2024.pdf
 
👉 Tirunelveli Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gir...
👉 Tirunelveli Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gir...👉 Tirunelveli Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gir...
👉 Tirunelveli Call Girls Service Just Call 🍑👄6378878445 🍑👄 Top Class Call Gir...
 
Guide to a Winning Interview May 2024 for MCWN
Guide to a Winning Interview May 2024 for MCWNGuide to a Winning Interview May 2024 for MCWN
Guide to a Winning Interview May 2024 for MCWN
 
Ganga Path Project (marine drive project) Patna ,Bihar .pdf
Ganga Path Project (marine drive project) Patna ,Bihar .pdfGanga Path Project (marine drive project) Patna ,Bihar .pdf
Ganga Path Project (marine drive project) Patna ,Bihar .pdf
 
Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
Jual obat aborsi Dubai ( 085657271886 ) Cytote pil telat bulan penggugur kand...
 
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Etawah [ 7014168258 ] Call Me For Genuine Models We...
 
9352852248 Call Girls Sanand Escort Service Available 24×7 In Sanand
9352852248 Call Girls  Sanand Escort Service Available 24×7 In Sanand9352852248 Call Girls  Sanand Escort Service Available 24×7 In Sanand
9352852248 Call Girls Sanand Escort Service Available 24×7 In Sanand
 
7737669865 Call Girls In Ahmedabad Escort Service Available 24×7 In In Ahmedabad
7737669865 Call Girls In Ahmedabad Escort Service Available 24×7 In In Ahmedabad7737669865 Call Girls In Ahmedabad Escort Service Available 24×7 In In Ahmedabad
7737669865 Call Girls In Ahmedabad Escort Service Available 24×7 In In Ahmedabad
 
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Rampur [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In Belgaum [ 7014168258 ] Call Me For Genuine Models W...
 
Crafting an effective CV for AYUSH Doctors.pdf
Crafting an effective CV for AYUSH Doctors.pdfCrafting an effective CV for AYUSH Doctors.pdf
Crafting an effective CV for AYUSH Doctors.pdf
 
K Venkat Naveen Kumar | GCP Data Engineer | CV
K Venkat Naveen Kumar | GCP Data Engineer | CVK Venkat Naveen Kumar | GCP Data Engineer | CV
K Venkat Naveen Kumar | GCP Data Engineer | CV
 
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
Top profile Call Girls In Jabalpur [ 7014168258 ] Call Me For Genuine Models ...
 
We’re looking for a junior patent engineer to join our Team!
We’re looking for a junior patent engineer to join our Team!We’re looking for a junior patent engineer to join our Team!
We’re looking for a junior patent engineer to join our Team!
 
Mysore Escorts Service Girl ^ 9332606886, WhatsApp Anytime Mysore
Mysore Escorts Service Girl ^ 9332606886, WhatsApp Anytime MysoreMysore Escorts Service Girl ^ 9332606886, WhatsApp Anytime Mysore
Mysore Escorts Service Girl ^ 9332606886, WhatsApp Anytime Mysore
 
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Ratnagiri [ 7014168258 ] Call Me For Genuine Models...
 
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
obat aborsi pacitan wa 081336238223 jual obat aborsi cytotec asli di pacitan0...
 
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdfUXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
UXPA Boston 2024 Maximize the Client Consultant Relationship.pdf
 
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
Dating Call Girls inTiruvallur { 9332606886 } VVIP NISHA Call Girls Near 5 St...
 
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In Anantapur [ 7014168258 ] Call Me For Genuine Models...
 

FAL(2022-23)_CSE0206_ETH_AP2022232000455_Reference_Material_I_16-Aug-2022_Module_1_2.pptx

  • 1. Dr. Avadhesh Kumar Asst. Prof, SAS, VIT-AP Object Oriented Programming
  • 2.  Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behavior.  Every class has data field(data member) and method(function).
  • 3.  A Java object is an instance of a Java class. Each object has an identity, a behavior and a state.  The state of an object is stored in fields (variables), while methods (functions) display the object's behavior. Objects are created at runtime from templates, which are also known as classes.
  • 4.
  • 5.  A class is a template or blueprint from which objects are created. So, an object is the instance(result) of a class.
  • 6.
  • 7.  Originally, object-oriented programming was used most frequently for two major types of applications:  Computer simulations, which attempt to mimic real-world activities so that their processes can be improved or so that users can better understand how the real-world processes operate  Graphical user interfaces, or GUIs (pronounced “gooeys”), which allow users to interact with a program in a graphical environment
  • 8.  To understand object-oriented programming it requires grasping three basic concepts:  1. Encapsulation  2. Inheritance  3. Polymorphism
  • 9.
  • 10.
  • 11.  A method is a self-contained block of program code that carries out some action, similar to a procedure (function) in a procedural program (C program).  It is like a function in C program but it is associated some class.  For example, a Dog class might have methods for walking, eating.
  • 12.  In object-oriented classes, attributes and methods are encapsulated into objects.  Encapsulation is the enclosure of data and methods within an object.  Encapsulation allows you to treat all of an object’s methods and data as a single entity. Just as an actual dog contains all of its attributes and abilities, so would a program’s Dog object.
  • 13.  Encapsulation also refers to the concealment of an object’s data and methods from outside sources.  Concealing data is sometimes called information hiding.  Encapsulation lets you hide specific object attributes and methods from outside sources and provides the security that keeps data and methods safe from inadvertent(undesired) changes.
  • 14.  An important feature of object-oriented program design is inheritance—the ability to create classes that share the attributes and methods of existing classes, but with more specific features.  For example, Automobile is a class, and all Automobile objects share many traits and abilities. Convertible is a class that inherits from the Automobile class; a Convertible is a type of Automobile that has and can do everything a “plain” Automobile does—but with an added ability
  • 15.  A final important concept in object-oriented terminology is polymorphism.  Literally, polymorphism means “many forms”—it describes the feature of languages that allows the same word or symbol to be interpreted correctly in different situations based on the context.  For example, although the classes Automobile, Sailboat, and Airplane all inherit from Vehicle, turn and stop methods work differently for instances of those classes.
  • 16.
  • 17.  It is a Java standard, although not a requirement, to begin class identifiers with an uppercaseletter and employ other uppercase letters as needed to improve readability.  (By contrast, method identifiers, like println(), conventionally begin with a lowercase letter.)  The stylethat joins words in which each word begins with an uppercase letter is called Pascal casing, or sometimes upper camel casing. You should follow established conventions for Java so  your programs will be easy for other programmers to interpret and follow.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.  To create a Scanner object and connect it to the System.in object, you write a statement similar to the following:  Scanner inputDevice = new Scanner(System.in);
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.  A main() method executes automatically when you run a program, but other methods do not execute simply because you place them within a class—they must be called.  The method header is the first line of a method. It contains the following:  Optional access specifiers  A return type  An identifier  Parentheses
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.  It is a special type of method which is used to initialize the object.  Every time an object is created using the new() keyword, at least one constructor is called.  It calls a default constructor if there is no constructor available in the class. In such case, Java compiler provides a default constructor by default.
  • 34.  Constructor name must be the same as its class name  There are two types of constructors in Java:  1. Default constructor (no-arg constructor)  2. Parameterized constructor
  • 35.
  • 36.  The access modifiers in Java specifies the accessibility or scope of a field, method, constructor, or class.  We can change the access level of fields, constructors, methods, and class by applying the access modifier on it.
  • 37.  Private: The access level of a private modifier is only within the class. It cannot be accessed from outside the class.  Default: The access level of a default modifier is only within the package. It cannot be accessed from outside the package. If you do not specify any access level, it will be the default.  Protected: The access level of a protected modifier is within the package and outside the package through child class. If you do not make the child class, it cannot be accessed from outside the package.  Public: The access level of a public modifier is everywhere. It can be accessed from within the class, outside the class, within the package and outside the package