Write a program that declares and initializes an int array with length 10. Then, set the first value in the array to be equal to 5, and set the last value in the array to be equal to 10. Finally, using the array, print out the sum of the first and last elements.
top of page
bottom of page
class Main { public static void main(String[] args) { int [] myarray = new int [10]; myarray [0] = 5; myarray [9] = 10; System.out.println(myarray [0] + myarray[9]); } }