Classes Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

An object that belongs to a particular class is called an _________ of that class. The process of creating an object is called ________

A

instance, instantiation

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

“Garbage collection” definition

A

objects that are no longer accessible in the program (no longer referred to by any variable) are automatically destroyed and the memory they occupy is recycled.

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

Public fields + methods:

A

accessible ANYWHERE in all your code

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

Private field + methods:

A

accessible ONLY within constructors and methods of the same class

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

A requirement on the AP exam is to make ALL instance variables ______

A

private

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

Encapsulation definition:

A

The concept of private fields and methods hiding the implementation details of a class from other classes, its clients.

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

A _____ class uses your class through constructors and public methods.

A

client

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

“Information Hiding” definition:

A

the practice of supplying as little information to client classes as possible. For example, if a method is used only internally within that class, it should be made PRIVATE

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

Since all instance variables are private, they are not directly accessible in client classes. It is common to provide special public methods, called ________, that return the values of instance variables.

A

accessors

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

Modifier definition

A

A public method that sets a new value of an instance variable is called a modifier

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