객체정렬하기
-
[코드트리 조별과제] 객체Algorithm 2024. 8. 4. 21:21
코딩테스트에 감이 떨어지기도 하고, 코테를 꾸준하게 도전하기 위해 코드트리 조별과제에 참여하게 되었다.내가 스스로 공부한 것을 조별과제에 참여할 겸, 기록에 남기기위해 정리하려고한다. 객체 정렬하기public class Main { public static class Student { String id; int score; public Student(String id, int score) { this.id = id; this.score = score; } } } 위에와 같이 Student라는 객체가 있고, Score를 기준으로 정렬을 하기 위해선 Comparable 인터페이스가 필요하다. Compara..