How do you find the sum of all the numbers in an array in java ...

How do you find the sum of all the numbers in an array in java ...

瀏覽:855
日期:2024-05-18
Once java-8 is out (March 2014) you'll be able to use streams: int[] a = {10,20,30, 40,50}; int sum = IntStream.of(a).sum(); System.out.println("The sum is " + sum);....看更多