How to use the this keyword in Java ?.
The this keyword is a special keyword frequently used in the Java programming language. Usually, this keyword is used when we want to refer currently executing object. Here this keyword is the reference to a calling object itself. When a object calls a method also called as Instance method, it has variable this which refers to object which has called it. By using this keyword you can refer or access to any field of a particular object in a method or constructor. Whenever an instance method or constructor is called this keywordis set to a variable holding reference to a object who has called it.
private int length;
private int breadth;