SlideShare a Scribd company logo
5
Most read
3. OBJECT-ORIENTED PROGRAMMING CONCEPTS

Software objects are conceptually similar to real-world objects: they too consist of a state and
related behavior. An object stores its state in fields (also called variables in programming
languages). An object also has methods (functions in programming languages). Methods
operate on an object's internal state and serve as the primary mechanism for object-to-object
communication. Hiding internal state and requiring all interaction to be performed through an
object's methods is known as data encapsulation — a fundamental principle of objectoriented programming.
We now explain the common terms used in object-oriented programming:
1. Objects and Classes:
An object is the basic entity in an object-oriented program. Program objects should be
chosen so that they match closely with the real-world objects. An object takes space in
memory and has an associated address. When a program is executed, the objects interact
with each other by sending messages. Each object contains data and code to manipulate
the data.
Just as in C programming language we can declare variables of different data types such
as int, float, char, etc., in Java, the entire set of data and code of an object can be made a
user-defined data type using the concept of class. A class may be thought of as a ‘data
type’ and an object as a ‘variable’ of that type. Once a class has been defined, we can
create objects belonging to that class. A class is thus a collection of objects of similar
type. E.g., banana, apple, grapes and mango are members of the class fruit.

2. Data Abstraction and Encapsulation:
Data encapsulation is also called data hiding. The wrapping up of data and methods into a
single unit called a class is known as encapsulation. The data is available only to the
methods which are wrapped in the class. These methods provide an interface between the
object’s data and the program. Thus, we say that the data is hidden from the program.
Encapsulation makes it possible to treat objects as ‘black boxes’, each performing a
specific task without any concern for the internal implementation. Encapsulation is the
mechanism that binds together code and the data it manipulates, and keeps both safe from
outside interference and misuse.
Information “in”

Data
and
Method

Information “out”

Data abstraction refers to the act of representing essential features without including the
background details or explanations. Abstraction means simplifying complex reality.

Java - Chapter 3

Page 1 of 5
The Java Programming Language

Difference between data abstraction and data encapsulation:
•
•

Representation of essential feature without including the background detail is called
data abstraction while collection of all data and method into a single unit called
encapsulation.
In data abstraction we were ignore about the details regarding an object type while
encapsulation describe details information about an object type.

What are the advantages of bundling code into objects?
1. Modularity:- The source code for an object can be written and maintained independently
of the source code for other objects. Once created, an object can be easily reused.
2. Information-hiding: By interacting only with an object's methods, the details of its
internal implementation remain hidden from the outside world.
3. Code re-use: If an object already exists (perhaps written by another software developer),
you can use that object in your program. This allows specialists to implement/test/debug
complex, task-specific objects, which you can then trust to run in your own code.
4. Pluggability and debugging ease: If a particular object turns out to be problematic, you
can simply remove it from your application and plug in a different object as its
replacement. This is analogous to fixing mechanical problems in the real world. If a bolt
breaks, you replace it, not the entire machine.

3. Inheritance
Inheritance is the process by which objects of one class acquire the properties of objects of
another class. Defining new classes from the existing one is called inheritance.. The new
class will get all the methods and properties of the existing class. The new class is known as
the sub class / child class / derived class. The existing class is known as the super class,
parent class / base class. Object-oriented programming allows classes to inherit commonly
used state and behavior from other classes. Inheritance is implied by “is-a” relationship.
In OOP, the concept of inheritance provides the idea of reusability. That is, we can add
features to an existing class without modifying it. We derive a new class from an already
existing class. The new class has the features of the old class as well.
For example, helicopter is a part of the class aircraft. This class aircraft can have other
subdivisions such as passenger aircraft, cargo plane, etc. In real life a manager is an
employee. So in OOPL, a manager class is inherited from the employee class.

4. Polymorphism
Polymorphism means the ability to take more than one form. A mathematical operation may
have different behaviour in different instances. This behaviour depends upon the type of data
used in the operation. E.g., consider the operation of addition (+). When applied on two
numbers, we get the sum of the two numbers (3 + 4 = 7). But when the same operator is
Page 2 of 5

Java - Chapter 3
The Java Programming Language

applied on strings, it produces a third string by concatenation (e.g., “INTER” + “NET” gives
“INTERNET”).
Polymorphism allows objects having different internal structures to share the same external
interface.

5. Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed in response to the
call. Dynamic binding means that the code associated with a given procedure call is not
known until the time of the call at runtime.
The concept of dynamic binding can be understood as follows: In strongly-typed
programming languages such as C, we must declare variable before they are used. E.g., in C,
we declare int k. This statement also defines the memory space for the variable k (in this case
2 bytes). With this declaration we bind the name k to the type integer. This enables the
compiler to check for data type consistency at compile time. If we wrote k = ‘MUMBAI’ it
will result in a data-type mismatch error. This type of binding is called “static binding”
because it is fixed at compile time.
Consider a variable N. If the type of variable is implicitly associated by its contents, we say
that N is dynamically bound to a data type T. This associative process is called dynamic
binding.
Consider the following example which is only possible with dynamic binding:
if somecondition() == TRUE then
n := 123
else
n := 'abc'
endif
The type of n after the if statement depends on the evaluation of somecondition(). If it is
TRUE, n is of type integer whereas in the other case it is of type string.

6. Message Communication
A message is a request to an object to invoke (execute) one of its methods. A message
therefore contains
•
•

the name of the method and
the arguments of the method.

In an object-oriented program, objects communicate with one another by sending and
receiving information. When an object receives a message, one of its method (or procedure /
function) is executed.

Prof. Mukesh N Tekwani

Page 3 of 5
The Java Programming Language

Message passing involves specifying the name of the object, the name of the method and the
information to be sent. E.g., consider the statement:
Employee.salary(name);
Here, Employee is the object, salary is the message (method) and name is the parameter that
contains information.

What Is a Package?
A package is a namespace that organizes a set of related classes and interfaces. Conceptually
you can think of packages as being similar to different folders on your computer. You might
keep HTML pages in one folder, images in another, and scripts or applications in yet another.
Because software written in the Java programming language can be composed of hundreds or
thousands of individual classes, it makes sense to keep things organized by placing related
classes and interfaces into packages.
The Java platform provides an enormous class library (a set of packages) suitable for use in
your own applications. This library is known as the "Application Programming Interface", or
"API" for short. Its packages represent the tasks most commonly associated with generalpurpose programming. For example, a String object contains state and behavior for
character strings; a File object allows a programmer to easily create, delete, inspect,
compare, or modify a file on the filesystem; a Socket object allows for the creation and use
of network sockets; various GUI objects control buttons and checkboxes and anything else
related to graphical user interfaces. There are literally thousands of classes to choose from.
This allows you, the programmer, to focus on the design of your particular application, rather
than the infrastructure required to make it work.

Questions and Exercises:
Objective Questions
1. Real-world objects contain ___ and ___.
2. A software object's state is stored in ___.
3. A software object's behavior is exposed through ___.
4. Hiding internal data from the outside world, and accessing it only through publicly
exposed methods is known as data ___.
5. A blueprint for a software object is called a ___.
6. Common behavior can be defined in a ___ and inherited into a ___ using the ___
keyword.
7. A collection of methods with no implementation is called an ___.
8. A namespace that organizes classes and interfaces by functionality is called a ___.
9. The term API stands for ___
Page 4 of 5

Java - Chapter 3
The Java Programming Language

QUESTIONS
1. What is object-oriented programming? How does it differ from procedure-oriented
programming? (Net-exercise)
2. How are data and methods organized in an object-oriented program?
3. What is an object? What are the advantages of bundling code into objects?
4. Distinguish between:
a. Classes and objects
b. Data encapsulation and data abstraction
c. Inheritance and polymorphism
d. Static and Dynamic binding
5. Define the terms inheritance and package.
6. What is message passing?

Answers to Questions
1. state and behavior.
2. fields.
3. methods.
4. encapsulation.
5. class.
6. superclass, subclass, extends.
7. interface.
8. package.
9. Application Programming Interface.

Prof. Mukesh N Tekwani

Page 5 of 5

More Related Content

PDF
Java chapter 3 - OOPs concepts
PDF
Python reading and writing files
PDF
Java chapter 1
PDF
Object oriented concepts ppt
PPT
Introduction to programing languages part 1
PPT
Introduction to programing languages part 3
PPT
Introduction to programing languages part 2
PDF
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR
Java chapter 3 - OOPs concepts
Python reading and writing files
Java chapter 1
Object oriented concepts ppt
Introduction to programing languages part 1
Introduction to programing languages part 3
Introduction to programing languages part 2
PSEUDOCODE TO SOURCE PROGRAMMING LANGUAGE TRANSLATOR

What's hot (19)

PPT
Introduction to programming languages part 1
PPT
Principles of compiler design
PPTX
POP vs OOP Introduction
DOCX
Notes of java first unit
PDF
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
PPT
Introduction to programming languages part 2
PPT
Basics1
PPTX
Chapter1 introduction
PDF
Handout#11
PPTX
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
PDF
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
PPT
Object oriented vs. object based programming
PDF
PPTX
diffrence between procedure oriented programming & object oriented programmin...
DOCX
C# Unit 2 notes
PPTX
Chapter 04 object oriented programming
PDF
Object oriented concepts
PDF
Handout#02
Introduction to programming languages part 1
Principles of compiler design
POP vs OOP Introduction
Notes of java first unit
SOFTWARE TOOL FOR TRANSLATING PSEUDOCODE TO A PROGRAMMING LANGUAGE
Introduction to programming languages part 2
Basics1
Chapter1 introduction
Handout#11
PROCEDURAL ORIENTED PROGRAMMING VS OBJECT ORIENTED PROGRAMING
Diving in OOP (Day 1) : Polymorphism and Inheritance (Early Binding/Compile T...
Object oriented vs. object based programming
diffrence between procedure oriented programming & object oriented programmin...
C# Unit 2 notes
Chapter 04 object oriented programming
Object oriented concepts
Handout#02
Ad

Viewers also liked (16)

PDF
PDF
Data Link Layer
PDF
Java misc1
PDF
Java chapter 6 - Arrays -syntax and use
PDF
Html graphics
PDF
Java 1-contd
DOCX
Python - Regular Expressions
PDF
Html tables examples
PDF
Java swing 1
PDF
Digital signal and image processing FAQ
PDF
Java chapter 5
PDF
Phases of the Compiler - Systems Programming
PDF
Data communications ch 1
PDF
Chap 3 data and signals
PPT
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
PDF
Introduction to systems programming
Data Link Layer
Java misc1
Java chapter 6 - Arrays -syntax and use
Html graphics
Java 1-contd
Python - Regular Expressions
Html tables examples
Java swing 1
Digital signal and image processing FAQ
Java chapter 5
Phases of the Compiler - Systems Programming
Data communications ch 1
Chap 3 data and signals
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
Introduction to systems programming
Ad

Similar to Java chapter 3 (20)

PDF
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
PDF
Java Programming Paradigms Chapter 1
PPTX
Java Programming - UNIT - 1, Basics OOPS, Differences
PDF
M.c.a. (sem iv)- java programming
PPTX
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
PDF
MCA NOTES.pdf
PPTX
1 unit (oops)
PPT
Basic Java Concept - Practical Oriented Methodologies
PPTX
Introduction to oop and java fundamentals
PPT
Share Unit 1- Basic concept of object-oriented-programming.ppt
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
DOCX
Object Oriented Programming All Unit Notes
PDF
Cs2305 programming paradigms lecturer notes
PPTX
UNIT - 1 Java Fundamentals, Basics of java
PPTX
Birasa 1
PPTX
JAVA PROGRAMMING
DOC
Chapter1
PPTX
JAVA PROGRAMMINGD
PPTX
U1 JAVA.pptx
DOCX
OOP Lab-manual btech in cse kerala technological university
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Programming Paradigms Chapter 1
Java Programming - UNIT - 1, Basics OOPS, Differences
M.c.a. (sem iv)- java programming
UNIT I OOP AND JAVA FUNDAMENTALS CONSTRUCTOR
MCA NOTES.pdf
1 unit (oops)
Basic Java Concept - Practical Oriented Methodologies
Introduction to oop and java fundamentals
Share Unit 1- Basic concept of object-oriented-programming.ppt
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
Object Oriented Programming All Unit Notes
Cs2305 programming paradigms lecturer notes
UNIT - 1 Java Fundamentals, Basics of java
Birasa 1
JAVA PROGRAMMING
Chapter1
JAVA PROGRAMMINGD
U1 JAVA.pptx
OOP Lab-manual btech in cse kerala technological university

More from Mukesh Tekwani (20)

PDF
The Elphinstonian 1988-College Building Centenary Number (2).pdf
PPSX
Circular motion
PPSX
Gravitation
PDF
ISCE-Class 12-Question Bank - Electrostatics - Physics
PPTX
Hexadecimal to binary conversion
PPTX
Hexadecimal to decimal conversion
PPTX
Hexadecimal to octal conversion
PPTX
Gray code to binary conversion
PPTX
What is Gray Code?
PPSX
Decimal to Binary conversion
PDF
Video Lectures for IGCSE Physics 2020-21
PDF
Refraction and dispersion of light through a prism
PDF
Refraction of light at a plane surface
PDF
Spherical mirrors
PDF
Atom, origin of spectra Bohr's theory of hydrogen atom
PDF
Refraction of light at spherical surfaces of lenses
PDF
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
PPSX
Cyber Laws
PPSX
Social media
The Elphinstonian 1988-College Building Centenary Number (2).pdf
Circular motion
Gravitation
ISCE-Class 12-Question Bank - Electrostatics - Physics
Hexadecimal to binary conversion
Hexadecimal to decimal conversion
Hexadecimal to octal conversion
Gray code to binary conversion
What is Gray Code?
Decimal to Binary conversion
Video Lectures for IGCSE Physics 2020-21
Refraction and dispersion of light through a prism
Refraction of light at a plane surface
Spherical mirrors
Atom, origin of spectra Bohr's theory of hydrogen atom
Refraction of light at spherical surfaces of lenses
ISCE (XII) - PHYSICS BOARD EXAM FEB 2020 - WEIGHTAGE
Cyber Laws
Social media

Recently uploaded (20)

PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
01-Introduction-to-Information-Management.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
Cell Types and Its function , kingdom of life
PDF
TR - Agricultural Crops Production NC III.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Complications of Minimal Access Surgery at WLH
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
O5-L3 Freight Transport Ops (International) V1.pdf
01-Introduction-to-Information-Management.pdf
VCE English Exam - Section C Student Revision Booklet
Supply Chain Operations Speaking Notes -ICLT Program
Module 4: Burden of Disease Tutorial Slides S2 2025
Renaissance Architecture: A Journey from Faith to Humanism
Abdominal Access Techniques with Prof. Dr. R K Mishra
Anesthesia in Laparoscopic Surgery in India
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
Cell Types and Its function , kingdom of life
TR - Agricultural Crops Production NC III.pdf
Final Presentation General Medicine 03-08-2024.pptx
O7-L3 Supply Chain Operations - ICLT Program
Complications of Minimal Access Surgery at WLH
STATICS OF THE RIGID BODIES Hibbelers.pdf
Classroom Observation Tools for Teachers
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Microbial diseases, their pathogenesis and prophylaxis
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...

Java chapter 3

  • 1. 3. OBJECT-ORIENTED PROGRAMMING CONCEPTS Software objects are conceptually similar to real-world objects: they too consist of a state and related behavior. An object stores its state in fields (also called variables in programming languages). An object also has methods (functions in programming languages). Methods operate on an object's internal state and serve as the primary mechanism for object-to-object communication. Hiding internal state and requiring all interaction to be performed through an object's methods is known as data encapsulation — a fundamental principle of objectoriented programming. We now explain the common terms used in object-oriented programming: 1. Objects and Classes: An object is the basic entity in an object-oriented program. Program objects should be chosen so that they match closely with the real-world objects. An object takes space in memory and has an associated address. When a program is executed, the objects interact with each other by sending messages. Each object contains data and code to manipulate the data. Just as in C programming language we can declare variables of different data types such as int, float, char, etc., in Java, the entire set of data and code of an object can be made a user-defined data type using the concept of class. A class may be thought of as a ‘data type’ and an object as a ‘variable’ of that type. Once a class has been defined, we can create objects belonging to that class. A class is thus a collection of objects of similar type. E.g., banana, apple, grapes and mango are members of the class fruit. 2. Data Abstraction and Encapsulation: Data encapsulation is also called data hiding. The wrapping up of data and methods into a single unit called a class is known as encapsulation. The data is available only to the methods which are wrapped in the class. These methods provide an interface between the object’s data and the program. Thus, we say that the data is hidden from the program. Encapsulation makes it possible to treat objects as ‘black boxes’, each performing a specific task without any concern for the internal implementation. Encapsulation is the mechanism that binds together code and the data it manipulates, and keeps both safe from outside interference and misuse. Information “in” Data and Method Information “out” Data abstraction refers to the act of representing essential features without including the background details or explanations. Abstraction means simplifying complex reality. Java - Chapter 3 Page 1 of 5
  • 2. The Java Programming Language Difference between data abstraction and data encapsulation: • • Representation of essential feature without including the background detail is called data abstraction while collection of all data and method into a single unit called encapsulation. In data abstraction we were ignore about the details regarding an object type while encapsulation describe details information about an object type. What are the advantages of bundling code into objects? 1. Modularity:- The source code for an object can be written and maintained independently of the source code for other objects. Once created, an object can be easily reused. 2. Information-hiding: By interacting only with an object's methods, the details of its internal implementation remain hidden from the outside world. 3. Code re-use: If an object already exists (perhaps written by another software developer), you can use that object in your program. This allows specialists to implement/test/debug complex, task-specific objects, which you can then trust to run in your own code. 4. Pluggability and debugging ease: If a particular object turns out to be problematic, you can simply remove it from your application and plug in a different object as its replacement. This is analogous to fixing mechanical problems in the real world. If a bolt breaks, you replace it, not the entire machine. 3. Inheritance Inheritance is the process by which objects of one class acquire the properties of objects of another class. Defining new classes from the existing one is called inheritance.. The new class will get all the methods and properties of the existing class. The new class is known as the sub class / child class / derived class. The existing class is known as the super class, parent class / base class. Object-oriented programming allows classes to inherit commonly used state and behavior from other classes. Inheritance is implied by “is-a” relationship. In OOP, the concept of inheritance provides the idea of reusability. That is, we can add features to an existing class without modifying it. We derive a new class from an already existing class. The new class has the features of the old class as well. For example, helicopter is a part of the class aircraft. This class aircraft can have other subdivisions such as passenger aircraft, cargo plane, etc. In real life a manager is an employee. So in OOPL, a manager class is inherited from the employee class. 4. Polymorphism Polymorphism means the ability to take more than one form. A mathematical operation may have different behaviour in different instances. This behaviour depends upon the type of data used in the operation. E.g., consider the operation of addition (+). When applied on two numbers, we get the sum of the two numbers (3 + 4 = 7). But when the same operator is Page 2 of 5 Java - Chapter 3
  • 3. The Java Programming Language applied on strings, it produces a third string by concatenation (e.g., “INTER” + “NET” gives “INTERNET”). Polymorphism allows objects having different internal structures to share the same external interface. 5. Dynamic Binding Binding refers to the linking of a procedure call to the code to be executed in response to the call. Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at runtime. The concept of dynamic binding can be understood as follows: In strongly-typed programming languages such as C, we must declare variable before they are used. E.g., in C, we declare int k. This statement also defines the memory space for the variable k (in this case 2 bytes). With this declaration we bind the name k to the type integer. This enables the compiler to check for data type consistency at compile time. If we wrote k = ‘MUMBAI’ it will result in a data-type mismatch error. This type of binding is called “static binding” because it is fixed at compile time. Consider a variable N. If the type of variable is implicitly associated by its contents, we say that N is dynamically bound to a data type T. This associative process is called dynamic binding. Consider the following example which is only possible with dynamic binding: if somecondition() == TRUE then n := 123 else n := 'abc' endif The type of n after the if statement depends on the evaluation of somecondition(). If it is TRUE, n is of type integer whereas in the other case it is of type string. 6. Message Communication A message is a request to an object to invoke (execute) one of its methods. A message therefore contains • • the name of the method and the arguments of the method. In an object-oriented program, objects communicate with one another by sending and receiving information. When an object receives a message, one of its method (or procedure / function) is executed. Prof. Mukesh N Tekwani Page 3 of 5
  • 4. The Java Programming Language Message passing involves specifying the name of the object, the name of the method and the information to be sent. E.g., consider the statement: Employee.salary(name); Here, Employee is the object, salary is the message (method) and name is the parameter that contains information. What Is a Package? A package is a namespace that organizes a set of related classes and interfaces. Conceptually you can think of packages as being similar to different folders on your computer. You might keep HTML pages in one folder, images in another, and scripts or applications in yet another. Because software written in the Java programming language can be composed of hundreds or thousands of individual classes, it makes sense to keep things organized by placing related classes and interfaces into packages. The Java platform provides an enormous class library (a set of packages) suitable for use in your own applications. This library is known as the "Application Programming Interface", or "API" for short. Its packages represent the tasks most commonly associated with generalpurpose programming. For example, a String object contains state and behavior for character strings; a File object allows a programmer to easily create, delete, inspect, compare, or modify a file on the filesystem; a Socket object allows for the creation and use of network sockets; various GUI objects control buttons and checkboxes and anything else related to graphical user interfaces. There are literally thousands of classes to choose from. This allows you, the programmer, to focus on the design of your particular application, rather than the infrastructure required to make it work. Questions and Exercises: Objective Questions 1. Real-world objects contain ___ and ___. 2. A software object's state is stored in ___. 3. A software object's behavior is exposed through ___. 4. Hiding internal data from the outside world, and accessing it only through publicly exposed methods is known as data ___. 5. A blueprint for a software object is called a ___. 6. Common behavior can be defined in a ___ and inherited into a ___ using the ___ keyword. 7. A collection of methods with no implementation is called an ___. 8. A namespace that organizes classes and interfaces by functionality is called a ___. 9. The term API stands for ___ Page 4 of 5 Java - Chapter 3
  • 5. The Java Programming Language QUESTIONS 1. What is object-oriented programming? How does it differ from procedure-oriented programming? (Net-exercise) 2. How are data and methods organized in an object-oriented program? 3. What is an object? What are the advantages of bundling code into objects? 4. Distinguish between: a. Classes and objects b. Data encapsulation and data abstraction c. Inheritance and polymorphism d. Static and Dynamic binding 5. Define the terms inheritance and package. 6. What is message passing? Answers to Questions 1. state and behavior. 2. fields. 3. methods. 4. encapsulation. 5. class. 6. superclass, subclass, extends. 7. interface. 8. package. 9. Application Programming Interface. Prof. Mukesh N Tekwani Page 5 of 5