Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.*;
import java.util.Arrays;

public class Main {
    public static void main(String[] args) {
        Vector<Integer> vec = new Vector<Integer>(4);
        Integer[] anArray = new Integer[4];

        vec.add(4);
        vec.add(3);
        vec.add(2);
        vec.add(1);

        // fill the array from the vector
        vec.toArray(anArray);

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