Latest Already Graded A+
How many subclasses can inherit from the same superclass?
Infinitely many
What is the main benefit of using inheritance?
The subclass contains all of the methods/fields of the superclass, but the
subclass' code focuses on the unique aspects, making code simpler and easier
to read.
Why must the superclass' code be carefully documented?
Because that code is not physically in the subclass.
Interface
the methods that a class is required to contain; empty methods that are related
Should the methods in an interface be public or private?
MUST be public
Packages
organizes a set of related classes/interfaces; like a folder on your computer
,class library
a set of packages
API
Application Programming Language: Java's library of classes that you can use in
your own applications.
What do the Java API's packages represent? Give examples.
tasks for general purpose programming: String, File, Socket, some for developing
GUIs.
What is a benefit of using packages?
It allows developers to focus on the design of an application and NOT the
technical stuff that makes it work.
Real-world objects contain BLANK and BLANK.
State, behavior
A software object's state is stored in BLANK
fields
A software object's behavior is exposed through BLANK
methods (functions)
,Hiding internal data from the outside world, and accessing it only through
publicly exposed methods is known as data BLANK
Encapsulation
A blueprint for a software object is called a BLANK
class
Common behavior can be defined in a BLANK and inherited into a BLANK
using the BLANK keyword
superclass, subclass, extends
A collection of methods with no implementation is called an BLANK
interface
A namespace that organizes classes and interfaces by functionality is called a
BLANK
package
The term API stands for BLANK
Application Programming Interface
, Major Principles of Object-Oriented Programming
Encapsulation
Abstraction
Inheritance
Polymorphism
Accessor
method used to ask an object about itself
Should an accessor be public or private?
must be public
An accessor is any public method that gives information about the BLANK of an
object.
state
Mutator
public methods used to modify the state of an object while hiding the
implementation of the method
Benefits of Encapsulation
1. You can make changes to a class without breaking other code using that class.
2. You can handle situations where the class is being used improperly in such
a way that the code doesn't fail.