Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
medium Solved by 6 students

Initializing Array Elements With Loops

< Prev
Next >

An array books has been declared to store Book objects. Which of the following code segments correctly initializes each element of the books array with a new Book object?

I.

for (Book b : books)
    b = new Book();

II.

for (int i = 0; i < books.length; i++)
    books[i] = new Book();

III.

for (Book b : books)
    books[b] = new Book();
A

I, II, and III

B

II only

C

I and II only

D

III only

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1ravi.palepu22 0m 42s 158
#2kaisuki12 0m 00s 90
#3singh.advik1311 2m 07s -27
#4geethasailaja14 2m 06s -56
#5y.seong202723 4m 37s -87
#6singhris00014 5m 24s -254
#7bommasam00001 8m 08s -498
#8psak1201 10m 37s -647
Items per page:
10
1 – 8 of 8
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ