최대값
시각화를 출력할 때 말풍선 크기를 결정하려면, 라벨 목록에서 가장 긴 단어를 찾아야 합니다.
이 연습은 강의의 일부입니다
중급 Java
연습 안내
wordsList에 알맞은 타입을 지정하세요.- 더 긴 단어를 선택하도록 알맞은 비교식을 입력하세요.
- 가장 긴 단어를 찾는 올바른 메서드를 입력하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
class LongestFinder {
// Give the appropriate type to wordsList
static String findLongestIn(____ wordsList) {
String longest = "";
for (String word : wordsList) {
// Enter the fitting comparison to select the longer word
if (____)
longest = word;
}
return longest;
}
public static void main(String[] args) {
String[] words = {"possible", "first", "null", "avoidance", "mineral", "pretty", "tree", "rather", "innocuous"};
// Call the correct method to find the longest word
System.out.println(____(words));
}
}