代码
提交代码
import java.util.stream.Stream; public class Test{ public static void main(String...s) { int sum = Stream.of(1,2,3,4,5,6,7).reduce(0,(acc,e)-> acc + e); System.out.println(sum); } }
运行结果