// An application to demonstrate one-dimensional arrays public class SumArray { public static void main (String[] args) { // array declaration int a[] = new int[10]; // array declaration, including initialization int b[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }; int total=0; /* assign b to a - note the use of array instance variable length */ for (int i = 0; i < b.length; i++) a[i] = b[i]; /* sum the array */ for (int i = 0; i < a.length; i++) total += a[i]; System.out.println( "\n" + "The sum of the array is " + total + "\n"); } }