class triangle
{
float s1,s2,s3,area;
triangle(float s1,float s2,float s3)
{
s1=s1;
s2=s2;
s3=s3;
}
float getarea()
{
float p=getgirth()/2;
float area=(float)Math.sqrt(p*(p-s1)*(p-s2)*(p-s3));
return area;
}
float getgirth()
{
return s1+s2+s3;
}
}
public class Ex3-10
{
public static void main (String args[])
{
float s1=Integer.parseInt(args[0]),s2=Integer.parseInt(args[1]),s3=Integer.parseInt(args[2]),girth,area;
triangle ff=new triangle(3,4,5);
area=ff.getarea();
girth=ff.getgirth();
System.out.println(area+","+girth);
}
}
这是我刚写的一个java程序,但有个小问题,我一直找不出来,
Ex3-10.java:22: 需要 '{'
public class Ex3-10
^
大虾帮个忙啊,