说它在第 11 行。有什么帮助吗?我只是想按长度对 10 个字符串的数组进行排序。
import java.util.*;
public class lab10 {
public static void main(String[] args) {
Scanner key = new Scanner(System.in);
System.out.println("Enter 10 strings and I'll sort them by their length. Smallest to largest.");
String[] input = new String[10];
String smallest = input[0];
for(int i=0; i<10; i++){
if(input[i].length() < smallest.length()){
smallest = input[i];
}
System.out.println(smallest);
}
key.close();
}
}