class tirgon {
double a,b,c;
tirgon(){}
tirgon(double a,double b,double c)
{
setABC(a,b,c);
}
void setABC(double a,double b,double c)
{
tirgon tir=new tirgon();//生成了第二个对象
tir.a=a;
tir.b=b;
tir.c=c;
System.out.println("三角形一是:"+tir.a+","+tir.b+","+tir.c+",");
}
}
public class testtirgon
{
public static void main(String args [])
{
tirgon tir=new tirgon(3,4,5);//第一个tir对象
System.out.println("三角形二是:"+tir.a+","+tir.b+","+tir.c+",");
}
}
这样看结果比较明显!