Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
AP Computer Science A/Unit 7: ArrayList
Start Practice TestPractice Test
About Exam
easy Solved by 2 students

ArrayList Iteration and Product

Mark
< Prev
Next >

What is the output when the following code is executed?

import java.util.ArrayList;
public class WrapperTest {
    public static void main(String[] args) {
        ArrayList<Double> list = new ArrayList<>();
        list.add(2.0);
        list.add(3.0);
        list.add(4.0);
        double result = 1;
        for (Double d : list) {
            result = result * d;
        }
        System.out.println(result);
    }
}
A

2.0

B

Compilation Error

C

9.0

D

24.0

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

Question Leaderboard

Not enough data yet to show leaderboard.

AI Tutor

How can I help?

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