ex 5

PHOTO EMBED

Fri May 26 2023 12:38:24 GMT+0000 (Coordinated Universal Time)

Saved by @gokulz

import java.util.ArrayList;
public class Example {
    public static void main(String[] args) {
    
         // creating the list of integer type
    ArrayList <Integer> numList = new ArrayList<>();

       // add elements to the array
       numList.add(0);
       numList.add(1);
       numList.add(2);
       numList.add(3);
       numList.add(4);
       System.out.println(numList);

      // update element
       numList.set(0, 10);
       numList.set(2, 20);
       System.out.println(numList);

    }
}
content_copyCOPY