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

this(10);是什么意思?该如何解决

2012-01-02 
this(10)是什么意思?publicArrayList(){this(10)}[解决办法]调用本类其他构造函数,必须放在所在构造函数

this(10);是什么意思?
public   ArrayList()
{
        this(10);
}

[解决办法]
调用本类其他构造函数,必须放在所在构造函数的第一行
[解决办法]
调用本类参数为int的构造方法.
class A{
public A(int a){
System.out.println(a);
}
public A(){
this(10);//调用上面一个构造方法,参数为10,输出10;
}
}

热点排行