Help the world stop coronavirus! Stay home!

Prev Next

Java / Programs

Write a simple Java program to find the sum of all integers in a List.

public class SumofIntegersOfList {

	public static void main(String[] args) {
		List<Integer> myList = Arrays.asList(1, 2, 3, 4, 5);

		System.out.println("Sum :" + myList.stream().reduce((i, j) -> i + j));

	}
}

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

JVM

Comments & Discussions