this

The this keyword is used with instance methods and constructors to refer to the current object. Use of the keyword this in the very first statement in the body of a constructor means that another constructor in the same class is being called to assist in creation of the object. For example:

public class MyClass 
{

    private long birthday;
    private String name;

    // first constructor
    MyClass( String bDay )
    {
        birthday = formatBirthday( bDay );
    
    }

    // second constructor
    MyClass(String nm, String bDay )
    {   this ( bDay );
    
        name = new String(nm);
    
    }
}

Note   The keyword this must appear as the first statement in the body of a constructor, otherwise your code will not compile.

Use of the keyword this in an instance method is helpful when a variable using the same name appears within the method body. For example, when you refer to a class scope variable in a method containing the variable name x, the class scope variable would be known as this.x.