| preferred AP College board partner for AP classes
AP Computer Science A/Unit 7: ArrayList
Start Practice TestPractice Test
About Exam
easy Solved by 5 students
ArrayList Size Method
< Prev
Next >

Consider the following code segment.

import java.util.ArrayList;
public class Test {
    public static void main(String[] args) {
        ArrayList<String> animals = new ArrayList<>();
        animals.add("Cat");
        animals.add("Dog");
        System.out.println(animals.size());
    }
}

Which expression correctly determines the number of elements in the animals ArrayList?

A

animals.totalElements()

B

animals.count()

C

animals.size()

D

animals.length

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
#1anvitakeni0111 0m 00s 100
#2ganguhas00011 0m 00s 100
#3kaisuki11 0m 00s 100
#4y.seong202711 0m 16s 84
#5demosolasis111 1m 27s 13
Items per page:
10
1 – 5 of 5
No comments yet. Be the first to comment!

AI Tutor

How can I help?

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