public static void main(String[] args) {
String[] errorStr = new String[] {
"Line No: " + " " + 1,
"Line No: " + " " + 11,
"Line No: " + " " + 10,
"Line No: " + " " + 2,
"Line No: " + " " + 3
};
Arrays.sort(errorStr);
for(Object obj : errorStr){
System.out.println(obj);
}
}
有人能指出为什么排序在这里不起作用吗?
expected is,
Line No: 1
Line No: 2
Line No: 3
Line No: 10
Line No: 11
Actual is,
Line No: 1
Line No: 11
Line No: 10
Line No: 2
Line No: 3