Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;
import java.util.LinkedList;

public class Main {

    public static void main(String[] args) {

        LinkedList<String> list = new LinkedList<String>();

        list.add("Hello");
        list.add("from java2s.com");
        list.add("java tutorial");

        // print the list
        System.out.println("LinkedList:" + list);

        // create an array and copy the list to it
        Object[] array = list.toArray();

        System.out.println(Arrays.toString(array));
    }
}