首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

这个源程序中的Leaf increment()方法是什么解决方案

2012-01-19 
这个源程序中的Leaf increment()方法是什么class Leaf{private int i0Leaf increment(){i++return this

这个源程序中的Leaf increment()方法是什么
class Leaf
{
private int i=0;
Leaf increment()
{
i++;
return this;
}
void print()
{
System.out.println("i= "+i);
}
}

public class Self
{
public static void main(String args[])
{
Leaf x=new Leaf();
x.increment().increment().increment().print();
}

}


这个源程序中的Leaf increment()方法是什么


[解决办法]
你这个是 小树 长高的 列子 程序吧

i++ 它的属性 自增 1 
this 就是 Leaf本身。。。

热点排行