Q. Which of these is a correct way to create an ArrayList?

A
ArrayList list = new ArrayList();
B
List list = new ArrayList();
C
Both a and b
D
ArrayList list = new List();
Solution:

Both ArrayList list = new ArrayList(); and List list = new ArrayList(); are valid declarations.

Entri Contact Image

Get Expert Advice for Free: Register for Your Free Consultation Now!