Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.LinkedList;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<String> list = new LinkedList<String>();
        list.add("A");
        list.add("B");
        list.add("C");
        list.add("D");

        String[] colors = new String[list.size()];
        list.toArray(colors);

        for (int i = 0; i < colors.length; i++) {
            System.out.println("color = " + colors[i]);
        }
    }
}