| preferred AP College board partner for AP classes
AP Computer Science A/Unit 7: ArrayList
Start Practice TestPractice Test
About Exam
easy Solved by 15 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

The add method is used with an incompatible argument type.

B

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

C

The diamond operator is used incorrectly in the ArrayList instantiation.

D

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

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
#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