按字长排序显示错误
程序代码:
package lambda; import javax.swing.*; import java.util.Arrays; import java.util.Date; /** * Charles建立 * 2020/2/26 */ public class LambdaTest { public static void main(String[] args) { String[] planets=new String[]{"Mercury","Venus","Earth","Mars","Jupiter","Saturn","Uranus","Neptune"}; System.out.println(Arrays.toString(planets)); System.out.println("字典排序"); Arrays.sort(planets); System.out.println(Arrays.toString(planets)); System.out.println("字长排序"); Arrays.sort(planets,(first,second)->first.length()-second.length()); System.out.println(planets); Timer t=new Timer(1000,event-> System.out.println("The time is "+new Date())); t.start(); JOptionPane.showMessageDialog(null, "结束运行?"); System.exit(0); } }
最后字长排序显示[Ljava.lang.String;@2f4d3709
还有本来是
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;却打不出来,自动就改了