ArrayList Size Method
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
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | anvitakeni01 | 1 | 1 | 0m 00s | 100 |
| #2 | ganguhas000 | 1 | 1 | 0m 00s | 100 |
| #3 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #4 | y.seong2027 | 1 | 1 | 0m 16s | 84 |
| #5 | demosolasis1 | 1 | 1 | 1m 27s | 13 |
Items per page:
10
1 – 5 of 5
APFIVE