What is the this keyword in Java?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Java topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
The this keyword is a reference to the current object — the instance on which the method or constructor is being called. It is used to resolve ambiguity when instance field names clash with parameter names: this.name = name;. It is also used to call another constructor in the same class (constructor chaining): this(defaultValue); — must be the first statement. You can pass this as an argument to other methods. In anonymous classes or lambdas, this refers to the enclosing class instance, not the anonymous class. Static methods do not have access to this because they are not called on instances.
Pro Tip
Back up your answer with a specific project or situation. Saying 'In my last Java project, I used this when...' immediately makes your answer more credible and memorable.