반응형
1. 4번 추상 메서드가 1개만 있다면 상관 없다.
2. 4번 매개변수가 있는 생성자면 해당 매개변수와 일치하는 타입과 개수 순서로 구현된 함수형 인터페이스에서 생성자를 구현하면 된다.
3. 2번 매개변수가 여러개면 괄호로 감싸야지
4.
()->{
for(int i=0; i<3; i++){
System.out.println("작업 스레드가 실행됩니다.");
}
}
5.
()->System.out.println("Ok 버튼을 클릭했습니다.");
()->System.out.println("Cancel 버튼을 클릭했습니다.");
6.
public interface Function {
private double apply(double x, double y);
}
7.
int max = maxOrMin(
(x, y) ->{
if(x<y) return y;
else return x;
}
);
int min = maxOrMin(
(x, y) ->{
if(x>y) return y;
else return x;
}
);
8.
pulbic double avg(Function<Student> sf){
double result;
for(Student s : students){
result += sf.apply(s);
}
return result/students.length;
}
9.
Student::getEnglishScore
Student::getMathScore
올백
반응형
'Learn > 이것이 자바다' 카테고리의 다른 글
[이것이 자바다 확인 문제] chapter 17 (0) | 2024.12.12 |
---|---|
Stream Interface (1) | 2024.12.12 |
람다식, 함수형 프로그래밍, 메소드 참조, 생성자 참조 (1) | 2024.12.11 |
[이것이 자바다 확인문제] chapter 15 (0) | 2024.12.10 |
컬렉션, List, Set, Map, 검색, Stack,Queue, Synchronizaton, immodified (1) | 2024.12.10 |