DynamicArray-ArrayList

import java.util.ArrayList;
import java.util.List;

public class DynamicArray {

public static void main(String[] args) {
    // TODO Auto-generated method stub
    List 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]

你可能感兴趣的:(DynamicArray-ArrayList)