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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started