비교

목차 Comparable Comparable 인터페이스는 compareTo(T o) 메소드가 하나 선언되어 있다. 이 말은 Comparable 인터페이스를 사용하려면 compareTo(T o)을 재정의해야 한다는 것이다. 자기 자신과 매개변수 객체를 비교 한다. class dotone implements Comparable { int one; int two; dotone(int one, int two) { this.one = one; this.two = two; } // 정수 비교 public int compareTo(dotone o) { return this.two - o.two; } } class dottwo implements Comparable { String one; String two; dot..
너지살
'비교' 태그의 글 목록