Ask Question
2 November, 05:18

Two methods defined within a class are shown below. What can be said about the variable x used in both methods?

public int getSum (int y) {

return this. x + y; }

public int getMult (int y) {

return this. x * y; }

+1
Answers (1)
  1. 2 November, 06:20
    0
    Hi! Well, the variable 'x' is preceded by 'this.'. I can't say for sure what language this is, but it's probably Java or a C language, right? Then the 'this' refers to the instance of the class.

    So 'x' is an instance variable. That means it's a variable that belongs to an instantiated object.
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Two methods defined within a class are shown below. What can be said about the variable x used in both methods? public int getSum (int y) { ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers