java的調試
發布時間: 2023-06-28 01:59:22
『壹』 java調試
第一問:
publicclassPoint
{
intx,y;
floata,b;
staticintz;
voidsetValue(intm,intn)
{
this.x=m;
this.y=n;
}
voidsetValue(floata,floatb)
{
this.a=a;
this.b=b;
}
staticvoidoutput()
{
Pointpoint=newPoint();
System.out.println("x="+point.x+",y="+point.y+",a="+point.a+",b="+point.b+",z="+Point.z);
}
}
第二問:
publicPoint()
{
super();
}
publicPoint(intz1,intz2,floatz3,floatz4)
{
this.x=z1;
this.y=z2;
this.a=z3;
this.b=z4;
}
第三問:
publicstaticvoidmain(String[]args)
{
Pointpt1=newPoint();
pt1.setValue(1,2);
pt1.setValue(3,4);
Pointpt2=newPoint();
pt2.setValue(5,6);
pt2.setValue(7,8);
}
第四問:
Pointpt3=newPoint(9,10,11,12);
第五問:
System.out.println("x="+pt1.x+",y="+pt1.y+",a="+pt1.a+",b="+pt1.b);
System.out.println("x="+pt2.x+",y="+pt2.y+",a="+pt2.a+",b="+pt2.b);
第六問:
System.out.println("pt1.z="+pt1.z);
System.out.println("pt2.z="+pt2.z);
System.out.println("pt3.z="+pt3.z);
pt1.output();
pt2.output();
pt3.output();
System.out.println("Point.z="+Point.z);
Point.output();
output();
希望可以幫到你。
熱點內容