当前位置: 代码迷 >> J2SE >> this(10);是什么意思?该如何解决
  详细解决方案

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

热度:365   发布时间:2016-04-24 15:33:50.0
this(10);是什么意思?
public   ArrayList()
{
        this(10);
}

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