import java.util.ArrayList;
import java.util.List;
public class DynamicArray {
public static void main(String[] args) {
// TODO Auto-generated method stub
List<String> stocks = new ArrayList<>();
stocks.add("ORCL");
stocks.add("AAPL");
stocks.add("GOOG");
stocks.add("IBM");
stocks.add("MCD");
System.out.println("stocks: " + stocks);
}
}
Console:
stocks: [ORCL, AAPL, GOOG, IBM, MCD]