[code=java]
public class LineSeg{

  // these are the attributes of a LineSeg object
  private Point end1;
  private Point end2;
  private double length;

    // the constructor
    public LineSeg(double x1, double y1, double x2, double y2) {

        end1 = new Point(x1,y1);
        end2 = new Point(x2,y2);
        this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));
     }  
 }

cant think of anything to make it work continuously giving the same error

You have to many * in this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));

There's no "**" operator in Java. Either use Math.pow or write your own squaring function.