Chapter 7 - Terminology Flashcards

1
Q

The members of a Java class include its:

A

instance variables, class variables, and methods.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

One copy of each instance variable is created for every:

A

object instantiated from the class.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The ____ access modifier allows the class or member to be accessed by other classes.

A

public

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The _____ access modifier specifies that the class or member can be accessed only by other members of the same class.

A

private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

_____ access allows other classes in the same package or folder to access the class or class members.

A

Package

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Classes, constructors, final class variables, and class methods typically are declared as ____, and instance variables typically are declared as ____.

A
  1. public

2. private

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Instance variables reflect the properties that all ____ will have in common.

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

____ variables are defined by specifying an access modifier, data type, identifier, and, optionally, an initial value.

A

Instance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A method is defined by providing:

A

a method header

which specifies the access modifier, a return type, the method name, and a parameter list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A method with a ____ return type does not return a value.

A

void

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

True or false? Instance variables and methods have class scope in that they can be accessed anywhere in the class.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A method can be overloaded by defining another method with the same name but a different signature; that is, ________.

A

with a different number of parameters or with parameters of different data types.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

______ are responsible for initializing the instance variables of the class.

A

Constructors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

If we don’t provide a constructor, the compiler provides a ______, which is a constructor that takes no arguments.

A

default constructor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

_____ 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.

A

Accessor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

_____ 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.

A

Mutator

17
Q

When a method begins executing, the ____ sets the object reference this to refer to the object for which the method has been called.

A

JVM

18
Q

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.

A

toString

19
Q

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.

A

equals

20
Q

____ 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.

A

Static

21
Q

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.

A

public

22
Q

____ class methods can reference only static variables, can call only ____ methods, and cannot use the object reference this.

A

static

23
Q

A ______ method can reference both class and instance variables, as well as class and instance methods, and the reference this.

A

non-static, or instance

24
Q

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.

A

graphical

25
Q

_____ types can be defined to give meaning to ordered sets that are represented in a program by numbers.

A

Enumeration

26
Q

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.

A

enum

27
Q

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 _____.

A

/** and ending with */

28
Q

With Javadoc you can describe each parameter using the ____ and return value using the ____.

A

@param tag

@return tag.