Skip to content
Sharp

Object-oriented programming · interview question

Which of the following is a correct use of 'this' in a method?

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

Correct answer

A. This.someMethod();

Why

'this.someMethod();' is a correct usage as it calls an instance method of the current object. 'this' cannot be used to call static methods or to assign new objects.

Test yourself on Object-oriented programming

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

Start free test
All Object-oriented programming questions →