Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

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

        List<String> srclst = new ArrayList<String>(5);
        List<String> destlst = new ArrayList<String>(10);

        // populate two lists
        srclst.add("tutorial");
        srclst.add("from");
        srclst.add("java2s.com");

        destlst.add("Java Tutorial");
        destlst.add("From");
        destlst.add("Java2s.com");

        // copy into dest list
        Collections.copy(destlst, srclst);

        System.out.println("Value of source list: " + srclst);
        System.out.println("Value of destination list: " + destlst);
    }
}