ArrayList Add Method Type Compatibility
Consider these declarations.
ArrayList<Character> charList = new ArrayList<Character>();
String s = "A";
int num = 65;
Which statement will cause an error?
A
charList.add(s.charAt(0));
B
charList.add(s);
C
charList.add((char) num);
D
charList.add(Character.valueOf(‘C’));
Question Leaderboard
| Rank | |||||
|---|---|---|---|---|---|
| #1 | kaisuki | 1 | 1 | 0m 00s | 100 |
| #2 | y.seong2027 | 1 | 2 | 1m 04s | 26 |
| #3 | singhris000 | 1 | 4 | 1m 58s | -48 |
APFIVE