mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-02 05:18:02 +07:00
GitOrigin-RevId: 287af8db31ae356162add06e3564c4052025a026
25 lines
391 B
Java
25 lines
391 B
Java
class Complex {
|
|
private final double x, y;
|
|
|
|
Complex(double x, double y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
double getModulus() {
|
|
return Math.hypot(x, y);
|
|
}
|
|
|
|
double getX() {
|
|
return x;
|
|
}
|
|
|
|
double getY() {
|
|
return y;
|
|
}
|
|
}
|
|
class Use {
|
|
void test(Complex c) {
|
|
System.out.println(c.getM<caret>odulus());
|
|
}
|
|
} |