The "this" keyword


public class Rectangle {
   private int width;
   private int height;

   
   // setHeight method of Rectangle class:
   public void setHeight( int height ) {
      height = height; // ??? Shadowing: Which height is which ???
   }
}







public class Rectangle {
   private int width;
   private int height;

   
   // Avoid shadowing using "this":
   public void setHeight( int height ) {
      this.height = height;
      
      // "This" Rectangle's instance variable height
      // is equal to the value of the input parameter
      // variable height.
   }
}