public class Test {
private int width,height;
public Test(int i,int j)
{
width = i;
height = j;
}
public Test()
{
Test(10,20);
}
public int getWidht()
{
return width;
}
public int getHeight()
{
return height;
}
}以上一个简单的类,我要在Test()中调用另外一个构造函数,但是不知道怎么写.
private int width,height;
public Test(int i,int j)
{
width = i;
height = j;
}
public Test()
{
Test(10,20);
}
public int getWidht()
{
return width;
}
public int getHeight()
{
return height;
}
}以上一个简单的类,我要在Test()中调用另外一个构造函数,但是不知道怎么写.
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货