Can 'this' keyword be assigned a new value in Java?

No, the this keyword cannot be assigned a new value in Java. It is a final, read-only reference that always points to the current object whose method or constructor is being executed. The Java compiler manages this reference automatically, and developers cannot modify or reassign it.

Key Points

Example

When a method is called on an object, this automatically points to that object.

class Employee {

    String name;

    Employee(String name) {

        this.name = name;
    }

    void display() {

        System.out.println(this.name);
    }
}

public class Demo {

    public static void main(String[] args) {

        Employee employee = new Employee("Amol");

        employee.display();
    }
}

Output

Amol

Invalid Usage

class Employee {

    void display() {

        this = new Employee(); // Compilation Error
    }
}

Compilation Error

cannot assign a value to 'this'

Why Is Reassignment Not Allowed?

Common Uses of this

this.name = name;

this.display();

this("Java");

Important Note

The this keyword can only be used inside instance methods, constructors, and instance initialization blocks. It cannot be used inside static methods because static methods belong to the class, not to a specific object.

Interview Tip

A concise interview answer is

No, the this keyword cannot be assigned a new value. It is a read-only reference automatically maintained by the JVM and always points to the current object. Any attempt to reassign it results in a compilation error.

Last updated: 16 July 2026

Previous question: What are the 'this' and 'super' keywords in Java?

Next question: What happens if you attempt to use the "super" keyword in a class that doesn't have a superclass?

More Core Java - Level II interview questions

All Core Java - Level II questions