Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static void copyList() {
        List<Integer> l = new ArrayList<Integer>();
        l.add(1);
        l.add(2);
        l.add(3);
        l.add(4);
        List<Integer> lCopy = new ArrayList<Integer>(l);
        l.remove(0);
        System.out.println(l);
        System.out.println(lCopy);
    }
}