代码
提交代码
import java.util.function.BinaryOperator; public class Test { public static int staticNum; private int num; public void doTest() { BinaryOperator<Integer> add1 = (x, y) -> { num = 3; staticNum = 4; return x + y + num + Test.staticNum; }; Integer apply = add1.apply(1, 2); System.out.println(apply); } public static void main(String[] args) { new Test().doTest(); } }
运行结果