You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
541 B

  1. class IntComparable implements Comparable<IntComparable> {
  2. private int value;
  3. IntComparable(int value) {
  4. this.value = value;
  5. }
  6. @Override
  7. public int compareTo(IntComparable other) {
  8. return Integer.compare(this.value, other.value);
  9. }
  10. // Terry newly added
  11. public int getValue() {
  12. return value;
  13. }
  14. @Override
  15. public String toString() {
  16. // Verwenden Sie eine geeignete String-Darstellung, zum Beispiel den Wert selbst
  17. return Integer.toString(value);
  18. }
  19. }