| 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
< 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

24.0

B

9.0

C

Compilation Error

D

2.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.

No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: [email protected]|Privacy Policy