Question: Assume that you have created a class that contains a private field named myField and a nonstatic public method named myMethod(). Which of the following

Assume that you have created a class that contains a private field named myField and a nonstatic public method named myMethod(). Which of the following is true?

a. myMethod() has access to myField and can use it.

b. myMethod() does not have access to myField and cannot use it.

c. myMethod() can use myField but cannot pass it to other methods.

d. myMethod() can use myField only if it is passed to myMethod() as a parameter.

Step by Step Solution

3.51 Rating (164 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a myMethod has access to ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Logic & Design Questions!