How to find Sum Of Integers

 Interview Question for 2+ experienced

How to find Sum Of Integers

Solution :

package p2;
import java.util.List;
import java.util.Arrays;
public class SumOfInteger {
public static void main(String[] args) {
List<Integer> list=Arrays.asList(10,30,20);
    Integer sum=list.stream().mapToInt(i->i).sum();
    System.out.println(sum);
}
}

******************************************************************

O/P : 60


Comments