제네릭 메서드를 바탕으로 점수 및 단어를 정렬하는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요
86 89 90 apple banana carrot
public class GenericMethodMain
{
public static < <>> void sort( [] list ) {
( int last = list. - 1; last 0; last ) {
( int index = 0; index last; index ) {
( list[ index ].( list[ index + 1 ] ) 0 ) {
temp = list[ index ];
list[ index ] = list[ index + 1 ];
list[ index + 1 ] = temp;
}
}
}
}
public static void main( String[] args ) {
[] scores = new []{ 90, 89, 86 };
sort( scores );
( int score : scores )
System.out.print( score + " " );
System.out.println();
[] words = new []{ "carrot", "banana", "apple" };
sort( words );
( word : words )
System.out.print( word + " " );
}
}