Java8 Lumbda表达式 初步
package com.stono.test; import java.util.function.BinaryOperator; public class Test001 { public static void main(String[] args) { Runnable r = () -> System.out.println("hello"); r.run(); Runnable r2 = () -> { System.out.println("1"); System.out.println("2"); }; r2.run(); BinaryOperator<Long> b = (x, y) -> x + y; System.out.println(b); Long long1 = b.apply(1l, 2l); System.out.println(long1); } } // btnNewButton.addActionListener(event -> System.out.println("button Click")); ActionListener actionListener = event -> System.out.println("button Click2"); btnNewButton.addActionListener(actionListener);