//
class Pt3DCls{
double x, y, z;
Pt3DCls(double x){
this(x, x * 10, x * 100);
}
Pt3DCls(double x, double y){
this(x, y, x * 100);
}
Pt3DCls(double x, double y, double z){
this.x = x;
this.y = y;
this.z = z;
}
}
//
public class THIS_KEYWARD {
public static void main(String[] args) {
System.out.println("Start");
//
System.out.println("------------------------");
//
Pt3DCls p1 = new Pt3DCls(10.0);
System.out.println("x = " + p1.x);
System.out.println("y = " + p1.y);
System.out.println("z = " + p1.z);
//
System.out.println("------------------------");
System.out.println("End");
}
}
|