Objects and Classes Flashcards Preview

► Java > Objects and Classes > Flashcards

Flashcards in Objects and Classes Deck (8)
Loading flashcards...
1
Q

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

A

Only one.

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.
3
Q

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

A

A class

4
Q

__ is a construct that defines objects of the same type

A

A class

5
Q

An object is an instance of a __

A

class

6
Q

__ is invoked to create an object

A

A constructor

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

8
Q

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

A

false, 0, null