Consider the following method for these two questions public void quandary(int x
ID: 3645007 • Letter: C
Question
Consider the following method for these two questionspublic void quandary(int x){
number = x * 5;
}
Assume that the method compiles as written.
4. Which of the following is true about the variable number?
a. It would need to be imported from another object
b. It would need to be declared on a scope level above the method in order to be used in this manner.
c. It needs to be declared public in order to be used in this manner.
d. It needs to be declared private in order to be used in this manner.
Ans: ?????
5. What would be the ramifications of changing the method quandary to private instead of public?
a. We would not be able to use the number variable without declaring it inside of the method.
b. We would not be able to have a void return type.
c. We would not be able to use the quandary method outside of this class.
d. We would not be able to use the number variable outside of this class.
Ans: ?????
Explanation / Answer
4 b. It would need to be declared on a scope level above the method in order to be used in this manner. 5 c. We would not be able to use the quandary method outside of this class.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.