Which of the following is the correct syntax to declare an ArrayList in Java?

Q & ACategory: Data StructureWhich of the following is the correct syntax to declare an ArrayList in Java?
Admin Staff asked 4 years ago

Which of the following is the correct syntax to declare an ArrayList in Java?
a) ArrayList al = new ArrayList();
b) ArrayList al = new ArrayList[];
c) ArrayList al() = new ArrayList();
d) ArrayList al[] = new ArrayList[];

1 Answers
Admin Staff answered 4 years ago

a) ArrayList al = new ArrayList();