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.
To see this working, head to your live site.
Search
kevinzhao183
Jan 31
Intro to Java 1/30/21 Homework
Intro to Java 1/30/21 Homework
1 comment
0
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]); } }