5.1.2 Comp Sci A

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the scope of private methods and private instance variables? a. Any class using an object of the declaring class b. The declaring class c. The main method d. Only the private methods of the declaring class

b

Class members that should be public are: I. Constructors II. Instance Variables III. Accessors/ Mutators IV. Methods the class uses for itself, but the user does not need V. Methods the user needs to manipulate the objects of the class a. I, II, IV b. I, II, III c. I, III, V d. I, II, III, V

c

Classes' access specifier is generally set to: a. private to prevent any user from accessing and modifying any instance variables. b. private so that only certain users can create objects of the class. c. public so that all data and methods are accessible by any user. d. public so that any user can create and use objects of the class.

d

What is the difference between a getter method and an accessor method? a. A getter method allows you to get the value of a field while an accessor method sets the value of the field. b. A getter method allows you to get the value of a field while an accessor method is not often used in Java. c. A getter method gets the name of the class while an accessor method gets the value of the field. d. There is no difference. They refer to the same idea.

d

Accessors and mutators are used to: a. Allow private data to be accessed outside of the class and be safely modified. b. Allow users to access and modify any of the class's data in any way they wish. c. Prevent users from manipulating private data. d. Allow public data to be accessed and safely modified.

a


Conjuntos de estudio relacionados

Intro to Psychology FE Ch. 10/12

View Set

Biology: Unit 3: Cells Transport

View Set

MGMT 425 Exam 2 Study Guide (5,8,9,10)

View Set

Pharmacological and Parental Therapies EAQs

View Set