Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.ArrayList;

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

        ArrayList<String> arrlist = new ArrayList<String>(5);

        arrlist.add("G");
        arrlist.add("E");
        arrlist.add("F");
        arrlist.add("M");
        arrlist.add("E");
        arrlist.add("from java2s.com");

        System.out.println("Size of list: " + arrlist.size());

        System.out.println(arrlist);

        // Removes first occurrence of "E"
        boolean value = arrlist.remove("E");

        System.out.println("Now, Size of list: " + arrlist.size());

        System.out.println("Value = " + arrlist);
    }
}