构造函数的问题
public class test
{
int a,b,c,d;
public test(int x,int y)
{
a=x;
b=y;
}
public test(int p,int q,int r,int s)
{
test(p,q);
c=r;
d=s;
}
public static void main(String args[])
{
test temp=new test(1,2,3,4);
System.out.println(temp.a+""+temp.b+""+temp.c+""+temp.d);
}
}
这个程序编译会出错
public test(int x,int y)
{
a=x;
b=y;
}
test这个地方
但是在test前面加个void就可以通过了 这是为什么啊?