Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static void main(String[] args) {

        List<String> carList = new ArrayList<String>();

        carList.add("A");
        carList.add("B");
        carList.add("C");
        carList.add("D");

        String[] carArray = carList.toArray(new String[0]);

        for (String car : carArray) {
            System.out.println(car);
        }
    }
}
/*
A
B
C
D
    
*/