• Home
  • Textbooks
  • Introduction to Programming with Java: A Problem Solving Approach
  • Arrays and ArrayLists

Introduction to Programming with Java: A Problem Solving Approach

John S. Dean, Raymond H. Dean

Chapter 10

Arrays and ArrayLists - all with Video Answers

Educators


Chapter Questions

01:38

Problem 1

Normally, you should use the private access modifier for class variables. (T / F)

Aditya Sood
Aditya Sood
Numerade Educator
01:18

Problem 2

When should you declare a variable to be a class variable as opposed to an instance variable?

Jennifer Stoner
Jennifer Stoner
Numerade Educator
01:04

Problem 3

What are the default values for class variables?

Kristen Frankie
Kristen Frankie
Numerade Educator
03:07

Problem 4

In Figure 9.2 's Mouse 4 class, assume you have a method whose heading is public int getAge () Suppose you want to call this method from another class. What's wrong with the following statement?
int age $=$ Mouse $4 .$ getAge ()

SS
Sarvesh Somasundaram
Numerade Educator
01:38

Problem 5

Member access:
a) It is $\mathrm{OK}$ to use this in a class method. (T / $\mathrm{F}$ )
b) It is $\mathrm{OK}$ to use the class name as a prefix when calling a class method. (T / $\mathrm{F}$ )
c) Within a main method, it is OK to omit the class name prefix before the name of another class method being called. (T / F)

Aditya Sood
Aditya Sood
Numerade Educator
00:57

Problem 6

It is legal to access a class member from an instance method and also from a constructor. (T / $\mathrm{F}$ )

Aditya Sood
Aditya Sood
Numerade Educator
01:38

Problem 7

It is legal to directly access an instance member from a class method. (T / F)

Aditya Sood
Aditya Sood
Numerade Educator
01:18

Problem 8

What are four common reasons for making a method a class method?

Ameer Said
Ameer Said
Numerade Educator
00:39

Problem 9

What keyword converts a variable into a constant?

Ernest Castorena
Ernest Castorena
Numerade Educator
00:58

Problem 10

If you want a named constant used by instance methods to have the same value regardless of which object accesses it, the declaration should include the static modifier. (T / $\mathrm{F}$ )

Ernest Castorena
Ernest Castorena
Numerade Educator
00:58

Problem 11

A class constant should be initialized within a constructor. (T / F)

Ernest Castorena
Ernest Castorena
Numerade Educator
03:51

Problem 12

Suppose you have a grading program that instantiates multiple exam objects from an Exam class. Provide a declaration for a constant minimum passing score. Assume the minimum passing score for all exams is 59.5

Ruby P
Ruby P
Numerade Educator
01:38

Problem 13

A utility class's members should normally use the private and static modifiers. (T / F)

Aditya Sood
Aditya Sood
Numerade Educator