adplus-dvertising
frame-decoration

Question

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[];

Answer: (a).ArrayList al = new ArrayList();

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

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

Similar Questions

Discover Related MCQs

Q. In what type of dynamic array do you divide the array into two parts?

Q. What are the advantages of dynamic arrays?

Q. What is the time complexity for inserting/deleting at the beginning of the array?

Q. What are parallel arrays?

Q. What are the advantages of parallel arrays over the traditional arrays?

Q. What are some of the disadvantages of parallel arrays?

Q. What is a sorted array?

Q. To search for an element in a sorted array, which searching technique can be used?

Q. What are some of the applications of sorted arrays?

Q. What is the worst case time complexity of inserting an element into the sorted array?

Q. What is a sparse array?

Q. When do you use a sparse array?

Q. What is the difference between a normal(naive) array and a sparse array?

Q. Suppose the contents of an array A are, A = {1, null, null, null, null, 10};
What would be the size of the array considering it as a normal array and a sparse array?

Q. What is sparsity of a matrix?

Q. What are the advantages of sparse matrices over normal matrices?

Q. What is the order of a matrix?

Q. Which of the following property does not hold for matrix multiplication?

Q. How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and columns respectively)

Q. If row-major order is used, how is the following matrix stored in memory?
a b c

d e f

g h i