In java-8 you can use streams: int[] a = {10,20,30,40,50}; int sum = IntStream.of(a).sum(); System.out.println("The sum is " + sum);.
確定! 回上一頁