Program/ Example -
//In Java 8 - Find sum of all between 1 to 5
//Use streams
int sum = IntStream.of(1, 2, 3, 4, 5).sum(); //n.e. 1 + 2 + 3 + 4 + 5
System.out.println(sum);
|
Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.