Given the following program, show the values of the array: 1. public class Test
ID: 3548381 • Letter: G
Question
Given the following program, show the values of the array:
1. public class Test {
2. public static void main(String[] args) {
3. int[] values = new int[6];
4. values[2] = 2;
5. values[4] = 4;
6. for (int i = 0; i < 6; i++) {
7. values[i] *= i;
8. }
9. values[5] = values[0] + values[4];
10. }
11. }
-----------------------
1.show the contents of the array after it is created, after line #3:
2. show the contents of the array after the line #5:
3.show the contents of the array after the line #8:
4. show the contents of the array after the line #9:
Each answer should be comma seperated, such as:
1,2,3,4,5
Explanation / Answer
1. 0, 0, 0, 0, 0, 0
2. 0, 0, 2, 0, 4, 0
3. 0, 0, 4, 0, 16, 0
4. 0, 0, 4, 0, 16, 16
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.