Skip to content
Sharp

Object-oriented programming · interview question

Why does 'this' keyword in Java matter in practice?

Multiple choiceEasychapter-2-curatedpremiumoopobject-references
Choose one answer
Answer and explanation

Correct answer

B. To refer to the current object instance.

Why

The 'this' keyword in Java is used within a method or constructor to refer to the current object. It's often used to distinguish between instance variables and parameters with the same name.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →