1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| import javax.vecmath.Vector3d;
interface Position
{
public Vector3d getPosition();
}
public class ClassTest implements Position
{
public Position method_1(double input_x, double input_y, double input_z) {
x = input_x;
y = input_y;
z = input_z;
return this;
}
// main
public static void main(String[] args) {
Position position = new ClassTest().method_1(0.0, 0.0, 0.0);
Vector3d vector = position.getPosition();
System.out.printf("Main - position: (%lf, %lf, %lf)\n", vector.x, vector.y, vector.z);
}
// Interface Position
private double x, y, z;
public Vector3d getPosition() {
return new Vector3d(x, y, z);
}
} |
Partager