engineering computer science MCQ #1251

What is the purpose of the 'this' keyword in Java?

engineering computer science MCQ #1251

  1. Question 1

    Q1. What is the purpose of the 'this' keyword in Java?

    • A) To access superclass members
    • B) To access subclass members
    • C) To refer to the current object
    • D) To implement interfaces

    Answer: To refer to the current object

    Explanation: The 'this' keyword refers to the current object of the class, allowing for access to its members and resolution of naming conflicts.