Top Posters
Since Sunday
k
3
r
3
j
3
V
3
l
3
2
J
2
1
2
n
2
O
2
h
2
d
2
New Topic  
Coltonht Coltonht
wrote...
Posts: 430
4 years ago
Consider the following code fragment:

int[] list = new int[10];
for (int i = 0; i <= list.length; i++) {
list[i] = (int)(Math.random() * 10);
}

Which of the following statements is true?

▸ The loop body will execute 10 times, filling up the array with random numbers.

▸ list.length must be replaced by 10.

▸ The loop body will execute 10 times, filling up the array with zeros.

▸ The code has a runtime error indicating that the array is out of bound.
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 47 times
1 Reply
Replies
Answer verified by a subject expert
kwashington67kwashington67
wrote...
Posts: 382
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here

Related Topics

Coltonht Author
wrote...

4 years ago
Correct Slight Smile TY
wrote...

Yesterday
Thanks
wrote...

2 hours ago
You make an excellent tutor!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  976 People Browsing
 110 Signed Up Today
Related Images
  
 4456
  
 239
  
 333
Your Opinion