摘要:
一般this在各类语言中都表示“调用当前函数的对象”,java中也存在这种用法: 1 public class Leaf { 2 int i = 0; 3 Leaf increment(){ 4 i++; 5 return this; //this指代调用increment()函数的对象 6 } 7 void print(){ 8 System.out.println("i = " + i); 9 }10 public static void main(String[] args) {11 ... 阅读全文
posted @ 2013-11-22 11:29
CodingMonkey
阅读(1652)
评论(1)
推荐(2)

浙公网安备 33010602011771号