"nested" constructors?
Hi,
Please does anyone know how to call another constructor of this class from within a constructor, and return the new "this" thus created... oh boy, does that sentence make absolutely zero sense, or what?
For example:
/*immutable*/class Point{
publicfinalint x;
publicfinalint y;
public Point(int x,int y){
this.x = x;
this.y = y;
}
}
/*immutable*/class Line{
publicstaticfinal Point a;
publicstaticfinal Point b;
Line(Point a, Point b){
this.a = a;
this.b = b;
... call methods to calculate line lengths, angles etc etc ...
}
// <<<<<<<<<<<< here's the bit I can't figure out >>>>>>>>>>>
Line(int x1,int y1,int x2,int y2){
returnnew Line(new Point(x1, y1),new Point(x2, y2));
}
... define methods to calculate line lengths, angles etc etc ...
}
Or... Is there an "established convention" for working around this problem? Something like an private initialise() method which actually performs the "guts" of the "master constructor"?
Thanx in advance for any ideas
Keith.

