//
class Pt3DCls{
double x, y, z;
Pt3DCls(){
x = y = z = 0.0;
}
Pt3DCls(double dNum){
x = y = z = dNum;
}
}
//
public class Cons {
public static void main(String[] args) {
System.out.println("Start");
System.out.println("------------------------");
//
Pt3DCls p1 = new Pt3DCls();
System.out.println("x = " + p1.x);
System.out.println("y = " + p1.y);
System.out.println("z = " + p1.z);
//
Pt3DCls p2 = new Pt3DCls(1.0);
System.out.println("x = " + p2.x);
System.out.println("y = " + p2.y);
System.out.println("z = " + p2.z);
System.out.println("------------------------");
System.out.println("End");
}
}
|