Chapter 8 - Objects and Classes Flashcards

1
Q

How many classes in a file can be a public class?

A

Only one.

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

Constructors are a special kind of method. What are their three peculiarities?

A
A constructor must have the same name as the class itself.
Constructors do not have a return type, not even void.
Constructors are invoked using the new operator when an object is created. Constructors play the role of initializing objects.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

A

A class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
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
5
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
6
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
7
Q
Given the declaration Circle x = new Circle(), which of the following statement is most accurate
x contains an int value
x contains an object of the Circle type
x contains a reference to a Circle object
you can assign an int value to x
A

x contains a reference to a Circle object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
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