diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2026-02-02 10:35:57 +0100 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2026-02-02 10:35:57 +0100 |
| commit | ba6692d9b508b448eafd7bc71faa4ae3f3ac7199 (patch) | |
| tree | 93212290628cd6e62245328c7c9bade60ea16813 /semestre 4/java/tme/tp1/Segment.java | |
| parent | 7cacc4323027307aaa16f4d75a1e2ed4bf8362ff (diff) | |
Cours du 26 au 30 janvier
Diffstat (limited to 'semestre 4/java/tme/tp1/Segment.java')
| -rw-r--r-- | semestre 4/java/tme/tp1/Segment.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/semestre 4/java/tme/tp1/Segment.java b/semestre 4/java/tme/tp1/Segment.java new file mode 100644 index 0000000..6529279 --- /dev/null +++ b/semestre 4/java/tme/tp1/Segment.java @@ -0,0 +1,17 @@ +public class Segment { + private int x; + private int y; + + public Segment(int x, int y) { + this.x = x; + this.y = y; + } + + public int longueur() { + return x < y ? y - x : x - y; + } + + public String toString() { + return String.format("Segment [%d, %d]", x, y); + } +} |
