Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 8 students

ArrayList Declaration Syntax Error

< Prev
Next >

What is the reason the provided code fails to compile?

import java.util.ArrayList;
public class CapitalizationError {
    public static void main(String[] args) {
        Arraylist list = new ArrayList();
        list.add("Test");
        System.out.println(list);
    }
}
A

Incorrect capitalization: ‘Arraylist’ should be ‘ArrayList’.

B

The diamond operator is used incorrectly in the ArrayList instantiation.

C

A missing semicolon after list.add(“Test”) statement.

D

The add method is used with an incompatible argument type.

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

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1kaisuki11 0m 00s 100
#2winstonhou110711 0m 30s 70
#3geethasailaja11 0m 31s 69
#4singhris00011 1m 21s 19
#5bommasam00012 1m 17s 13
#6ravi.palepu01 0m 00s -10
#7ganguhas00001 0m 00s -10
#8psak1211 1m 51s -11
#9y.seong202722 3m 42s -22
#10singh.advik1311 2m 51s -71
Items per page:
10
1 – 10 of 10
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ