Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static void main(String args[]) {
        List<Character> list = new ArrayList<Character>();

        list.add('X');

        System.out.println("Element added to list: " + list.get(0));

        Collection<Character> immutableCol = Collections.unmodifiableCollection(list);

        immutableCol.add('Y');
    }
}