1.

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[];Question is taken from Dynamic Array in section Arrays Types of Data Structures & Algorithms II have been asked this question in an internship interview.

Answer»

The CORRECT option is (a) ArrayList AL = new ArrayList();

For explanation: This is a non-generic WAY of CREATING an ArrayList.



Discussion

No Comment Found

Related InterviewSolutions