| preferred AP College board partner for AP classes
AP Computer Science A/Unit 7: ArrayList
Start Practice TestPractice Test
About Exam
easy Solved by 3 students
ArrayList Traversal with a For Loop
< Prev
Next >

What is the output of the following code segment?

import java.util.ArrayList;
public class Test {
    public static void main(String[] args) {
       ArrayList<String> letters = new ArrayList<>();
       letters.add("a");
       letters.add("b");
       letters.add("c");
       for (int i = 0; i < letters.size(); i++) {
          System.out.print(letters.get(i));
       }
    }
}
A

a b c

B

cba

C

a c b

D

abc

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Time
Score
#1kaisuki11 0m 00s 100
#2tellabhinaya11 1m 43s -3
#3y.seong202711 4m 51s -191
Items per page:
10
1 – 3 of 3
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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