Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {

        ArrayList<Integer> arrlist = new ArrayList<Integer>();

        arrlist.add(10);
        arrlist.add(12);
        arrlist.add(31);
        arrlist.add(49);

        // toArray copies content into other array
        Integer myArray[] = new Integer[arrlist.size()];
        myArray = arrlist.toArray(myArray);

        System.out.println(Arrays.toString(myArray));

    }
}