Skip to content
Sharp

Object-oriented programming · interview question

In Java, how can instance methods affect the state of an object?

Multiple choiceEasychapter-2-curatedpremiumoopinstance-methods
Choose one answer
Answer and explanation

Correct answer

C. By modifying the object's instance variables.

Why

Instance methods can modify the state of an object by changing the values of its instance variables, which represent the object's state.

Test yourself on Object-oriented programming

A free test with instant, explained results. No account needed.

Start free test
All Object-oriented programming questions →