Question: What does the following code fragment print? int[] a = new int[10]; for (int i = 0; i < 10; i++) a[i] = 9 -

What does the following code fragment print?

int[] a = new int[10];

for (int i = 0; i < 10; i++)

a[i] = 9 - i;

for (int i = 0; i < 10; i++)

a[i] = a[a[i]];

for (int i = 0; i < 10; i++)

System.out.println(a[i]);

Step by Step Solution

3.33 Rating (165 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The code you posted creates an array of integers named a of size 10 fills it with numbers from 9 to ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction To Programming Questions!