Question: Question 1 price is an instance variable of a class. Inside that class there is a method public void change(int price). From inside the method

Question 1

price is an instance variable of a class. Inside that class there is a method public void change(int price).

From inside the method " change" how do we refer to the instance variable price and not the parameter price?

Answer:

Question 2

A method of a class can access which of the following:

1 global variables in the same scope

2. local variables defined within the method

3. the instance variables of its class

4. its parameters

Question 3

Which of the following are true of accessor methods:

1. accessor methods are of the same type as the variable to which they provide access.

2. accessor methods take no parameters

3. accessor methods are always of type void

4. accessor methods should be private

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!