JAVA 8 新特性 Lambda表达式
Runnable r1 = new Runnable() { @Override public void run() { System.out.println("北京"); } }; r1.run(); Runnable r2 = ()->System.out.println("上海"); r2.run(); Comparator<Integer> c = (o1,o2)->Integer.compare(o1,o2); int res = c.compare(12,21); //方法引用 Comparator<Integer> c1 = Integer::compare; int com = c1.compare(32,21); System.out.println(com);