Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (2.6k points)

I'm having a problem finding the sum of all of the integers in an array in Java.

1 Answer

0 votes
by (7.2k points)

To find the sum of all the numbers in an array in java.

int[] a = {100,200,300,400,500}; 

int SUM = IntStream.of(a).sum(); 

System.out.println("The sum is " + sum);

Output:

The sum is 1500.

Browse Categories

...