Ask Question
9 June, 06:43

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; }

+5
Answers (1)
  1. 9 June, 08:44
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers