(기초)그래서 뭘 배운거야?/Java
JV-69-API-MinBy / MaxBy : 최대값, 최소값 구하기
Soheny.P
2021. 11. 18. 18:19
728x90
import java.util.function.BinaryOperator;
public class Ex13MinByMaxBy {
public static void main(String[] args) {
Ex09Student s1 = new Ex09Student("호니", 95, 98);
Ex09Student s2 = new Ex09Student("수이", 100, 100);
Ex09Student s3;
BinaryOperator<Ex09Student> bo;
bo = BinaryOperator.minBy((f1, f2) -> Integer.compare(f1.getEngScore(), f2.getEngScore()));
s3 = bo.apply(s1, s2);
System.out.println(s3.getName());
}
}
728x90