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<Integer> arrlist = new ArrayList<Integer>(5);

        arrlist.add(1);
        arrlist.add(2);
        arrlist.add(2);
        arrlist.add(2);

        System.out.println(arrlist);

        // change element to 55 at 3rd position
        arrlist.set(2, 55);

        System.out.println(arrlist);
    }
}