Object-Oriented Programming Concepts Flashcards
Real-world objects share two characteristics: state and …
behaviour
… objects are conceptually similar to real-world objects
Software
Where does An object store its state?
in fields
How does An object exposes its behavior?
through methods
What does An object operate?
object’s internal state
What for does object 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
The source code for an object can be written and maintained independently of the source code for other objects
Modularity
By interacting only with an object’s methods, the details of its internal implementation remain hidden from the outside world
Information-hiding
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.
Pluggability
… is a blueprint or prototype from which objects are created
Class
each class is allowed to have … direct superclass
one
each superclass has the potential for an … of subclasses
unlimited number
At the end of your subclass declaration, use the … keyword
extends
… makes code for your subclasses easy to read
Inheritance
You must take care to … the state and behavior that each superclass defines
properly document
Superclass code … in the source file of each subclass
will not appear
What do methods form ?
the object’s interface with the outside world
… is a group of related methods with empty bodies.
interface
What is an interface?
A group of related methods with empty bodies.
To implement this interface you have to …
change new class name and use implements keyword
Which keyword do you use to implement interface?
implements
What do interfaces form?
a contract between the class and the outside world
When must all methods defined by that interface appear in class source code?
before the class will successfully compile
What Is a Package?
namespace that organizes a set of related classes and interfaces
… namespace that organizes a set of related classes and interfaces
package
Java platform provides an enormous class library (…)
a set of packages
What does Java API allow programmer?
focus on the design of your particular application