Skip to content
Sharp

Object-oriented programming · interview question

In which scenario is using 'this' unnecessary but still valid?

Multiple choiceHardchapter-2-curatedpremiumoopthis-keyword
Choose one answer
Answer and explanation

Correct answer

B. Accessing fields with unique names.

Why

Using 'this' is unnecessary when accessing fields with unique names because there is no ambiguity, but it is still valid and can be used to make the code more readable.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →