Back to marketplace

Chapter 3: Implementing Classes

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

Where does an object store its data?

Back (Answer)

an instance variable

#2
Front (Question)

What is an instance of a class?

Back (Answer)

an object of the class

#3
Front (Question)

What are the 3 parts that an instance variable declaration consist of?

Back (Answer)

1.) an access specifier (private) 2.) The type of the instance variable 3.) The name of the instance variable

#4
Front (Question)

Write a code for the click method, which advances the counter value by 1

Back (Answer)

public void click() { value = value + 1 }

#5
Front (Question)

Write the getValue method

Back (Answer)

public int getValue() { return value; }

#6
Front (Question)

T/F: Private instance values can only be accessed by methods of the same class.

Back (Answer)

True

#7
Front (Question)

What is encapsulation?

Back (Answer)

the process of hiding implementation details and providing methods for data access

#8
Front (Question)

What does encapsulation allow a programmer to do?

Back (Answer)

use a class without having to know its implementation

#9
Front (Question)

What does information hiding make it easier to do?

Back (Answer)

locate errors and change implementation

#10
Front (Question)

What do you need to know before implementing a class

Back (Answer)

which methods are required

#11
Front (Question)

What do constructors do?

Back (Answer)

set the initial data for objects

#12
Front (Question)

What is the name of a constructor?

Back (Answer)

the name of the class

#13
Front (Question)

What are constructors return type?

Back (Answer)

trick question: constructors have no return type (not even void)

#14
Front (Question)

What is the name for a constructor that takes no argument

Back (Answer)

a no-argument constructor

#15
Front (Question)

What is the following an example of? public BankAccount()

Back (Answer)

a no-argument constructor

#16
Front (Question)

Where do you place constructors and method declarations?

Back (Answer)

inside a class

#17
Front (Question)

What are documentation comments used for?

Back (Answer)

to describe the classes and public methods of your program

#18
Front (Question)

What is the @param tag used for

Back (Answer)

methods with no arguments

#19
Front (Question)

What is the @return tag used for

Back (Answer)

methods whose return type is void

#20
Front (Question)

What does the private implementation of a class consist of?

Back (Answer)

instance variables and the bodies of constructors and methods

#21
Front (Question)

What is the simple job of a constructor?

Back (Answer)

to initialize the instance variables of an object

#22
Front (Question)

What does a unit test do?

Back (Answer)

verify that a class works in isolation

#23
Front (Question)

What are the two ways to test a class?

Back (Answer)

use an environment for interactive testing, or write a tester class to execute test instructions

#24
Front (Question)

What is a local variable?

Back (Answer)

a variable that is declared in the body of a method