자바에서 compareTo가 의미하는 것
1. 자바에서 compareTo란?compareTo 메서드는 Comparable 인터페이스가 제공하는 메서드로 두 객체를 비교할 때 사용하는 메서드입니다.public class Jewel implements Comparable { int weight; int value; public Jewel(int weight, int value) { this.weight = weight; this.value = value; } @Override public int compareTo(Jewel o) { return this.weight - o.weight; }} 다음과 같이..