MODULE 2 (Week 3): Assessors, Mutators and Constructors Flashcards

1
Q

To create an instance of a class:

A

Supply a type and an identifier

Allocate computer memory for the object

Use the new operator

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

The name for a memory address where the object is held

A

Reference to the object

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

A method that creates and
initializes class objects

A

Constructor method

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

The name of the constructor should always be what?

A

The name of the class whose objects it constructs

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

After an object is instantiated,
its methods can be accessed
using:

A

The object’s identifier

A dot

A method call

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

Data fields are usually private; The client application accesses them only through:

A

Public interfaces

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

Controls the data values used to set a variable

A

Set method

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

Controls how a value is retrieved

A

Get method

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

A type of constructor that requires no arguments and is created automatically by a Java compiler whenever you do not write a constructor

A

Default constructors

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

What are the initial default values that a default constructor provides to an object’s data fields

A

Numerical field - set to 0

Character fields - set to Unicode \u0000

Boolean fields - set to false

Nonprimitive object fields - set to null

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

A construction method:

A

Must have the same name as the class it constructs

Cannot have a return type

Has a public access modifier

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

Classes that you create become data types and are often referred to as:

A

Abstract data types (ADTs)

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

Data types not built into the language

A

Programmer-defined data type

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

How to declare an object from one of your classes?

A

Provide the type and identifier

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