Chapter 9 Flashcards

1
Q

To prevent a class from being instantiated, _____________________

A

use the private modifier on the constructor

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

Given the declaration Circle[] x = new Circle[10], which of the following statement is most accurate?

A

x contains a reference to an array and each element in the array can hold a reference to a Circle object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q
Suppose the xMethod() is invoked from a main method in a class as follows, xMethod() is \_\_\_\_\_\_\_\_\_ in the class.
public static void main(String[] args) {
     xMethod();
}
A

a static method

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

Given the declaration Circle x = new Circle(), which of the following statement is most accurate.

A

x contains a reference to a Circle object.

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

Variables that are shared by every instances of a class are __________.

A
class variables
(AKA Static)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
X Suppose the xMethod() is invoked in the following constructor in a class, xMethod() is \_\_\_\_\_\_\_\_\_ in the class.
public MyClass() {
     xMethod();
}
A

a static method or an instance method

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

______ is a construct that defines objects of the same type.

A

A class

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

__________ represents an entity in the real world that can be distinctly identified.

A

An object

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

The keyword __________ is required to declare a class.

A

class

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

________ is invoked to create an object.

A

A constructor

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

You can declare two variables with the same name in __________.

A

different methods in a class

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

A method that is associated with an individual object is called __________.

A

an instance method

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

An object is an instance of a __________.

A

class

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

The default value for data field of a boolean type, numeric type, object type is ___________, respectively.

A

false, 0, null

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

To declare a constant MAX_LENGTH as a member of the class, you write

A

final static double MAX_LENGTH = 99.98;

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