求教大神 方法声明无效:需要返回类型 是啥意思?
import java.util.*;
public class Experiment2{
public static void main (String[] args){
Triangle t1 = new Triangle(1,0,0,1,0,0) ;
t1.show();
}
private boolean isTriangle = false;
private double l1 = 0.0d;
private double l2 = 0.0d;
private double l3 = 0.0d;
private double l = 0.0d;
private double s = 0.0f;
public Triangle(int x1,int y1,int x2,int y2,int x3,int y3)
{
Point a = new Point(x1,y1);
Point b = new Point(x2,y2);
Point c = new Point(x3,y3);
l1 = getLength(a,b);
l2 = getLength(a,c);
l3 = getLength(b,c);
getLong();
getArea();
}
private getLength(Point a,Point b){
double sub1 = 0.0d;
double sub2 = 0.0d;
sub1 = a.x>b.x?a.x - b.x: a.x - b.x;
sub2 = a.y>b.y?a.y - b.y: a.y - b.y;
double h = sub1*sub1+sub2*sub2;
return Math.sqrt(h);
}
private void getLength()
{
l = a+b+c;
}
public void getArea();
{
double p = (l1 + l2 + l3)/2;
s= Math.sqrt(p*(p-l1)*(p-l2)*(p-l3));
}
public void show();
{
System.out.println("First side is :"+l1);
System.out.println("Second side is :"+l2);
System.out.println("Third side is :"+l3);
System.out.println("The Long is :"+l);
System.out.println("The area is :"+s);
}
private class Point{
public int x = 0;
public int y = 0;
public Point(int px,int py){
x = px;
y = py;
}
}
}
这个要如何修改