What is wrong with each of the following code segments? a. int[] values = new int[10]; for

Question:

What is wrong with each of the following code segments?

a. int[] values = new int[10];
for (int i = 1; i <= 10; i++)
{
values[i] = i * i;
}
b. int[] values;
for (int i = 0; i < values.length; i++)
{
values[i] = i * i;
}

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: