Java Tutorial/Class Definition/This — различия между версиями

Материал из Java эксперт
Перейти к: навигация, поиск
 
м (1 версия)
 
(нет различий)

Текущая версия на 08:00, 1 июня 2010

The this Keyword

You use the this keyword from any method or constructor to refer to the current object.



   <source lang="java">

public class Box {

   int length;
   int width;
   int height;
   public Box(int length, int width, int height) {
       this.length = length;
       this.width = width;
       this.height = height;
   }

}</source>