Chapter 7 - Terminology Flashcards
The members of a Java class include its:
instance variables, class variables, and methods.
One copy of each instance variable is created for every:
object instantiated from the class.
The ____ access modifier allows the class or member to be accessed by other classes.
public
The _____ access modifier specifies that the class or member can be accessed only by other members of the same class.
private
_____ access allows other classes in the same package or folder to access the class or class members.
Package
Classes, constructors, final class variables, and class methods typically are declared as ____, and instance variables typically are declared as ____.
- public
2. private
Instance variables reflect the properties that all ____ will have in common.
objects
____ variables are defined by specifying an access modifier, data type, identifier, and, optionally, an initial value.
Instance
A method is defined by providing:
a method header
which specifies the access modifier, a return type, the method name, and a parameter list.
A method with a ____ return type does not return a value.
void
True or false? Instance variables and methods have class scope in that they can be accessed anywhere in the class.
True
A method can be overloaded by defining another method with the same name but a different signature; that is, ________.
with a different number of parameters or with parameters of different data types.
______ are responsible for initializing the instance variables of the class.
Constructors
If we don’t provide a constructor, the compiler provides a ______, which is a constructor that takes no arguments.
default constructor
_____ methods are named getIV, where IV is an instance variable name; the return data type is the same as the instance variable, and the body of the method simply returns the value of the instance variable.
Accessor
_____ methods are named setIV, where IV is an instance variable name; the return data type is void or a reference to this object, and the method takes one argument, which is the same data type as the instance variable and contains the new value for the instance variable. The body of the method should validate the new value and, if the new value is valid, assign the new value to the instance variable.
Mutator
When a method begins executing, the ____ sets the object reference this to refer to the object for which the method has been called.
JVM
The ____ method is called automatically when an object reference is used as a String, and its job is to provide a printable representation of the object data.
toString
The ____ method compares two objects for equality; that is, it should return true only if the corresponding instance variables in both objects are equal in value, and false otherwise.
equals
____ class variables are created when the class is initialized. Thus, class variables exist before any objects are instantiated, and each class has only one copy of the class variables.
Static
Static variables that are constants are usually declared to be ____ because they typically are provided to allow the client to set preferences for the operations of a class.
public
____ class methods can reference only static variables, can call only ____ methods, and cannot use the object reference this.
static
A ______ method can reference both class and instance variables, as well as class and instance methods, and the reference this.
non-static, or instance
A _____ object usually has instance variables for the starting (x, y) coordinate. It also provides a draw method that takes a GraphicsContext object as a parameter and includes the code to draw the graphical object.
graphical
_____ types can be defined to give meaning to ordered sets that are represented in a program by numbers.
Enumeration
For each name in an ___ type initialization list, a constant object is created with an instance variable having a sequential numeric value. References can be defined of the ___ type. Objects of the ___ type can be compared, printed, and requested to return their numeric value.
enum
Javadoc, which is part of the JDK, generates documentation for classes. To use Javadoc, you enclose a description of each class, method, and field in a block comment beginning with _____.
/** and ending with */
With Javadoc you can describe each parameter using the ____ and return value using the ____.
@param tag
@return tag.