Menu
Question Index
...

What will be the output of the following program?

import java.util.*;
public class Remove {
    public static void main(String args[]) {
        ArrayList arr = new ArrayList();
        arr.add("some");
        try {
            for (int i = 0; i < 4; i++) {
                arr.get(i);
            }
            System.out.print(arr);
        } catch (IndexOutOfBoundsException e) {
            System.out.print("index error");
        }
    }
}


some
index error
Some other output
Compilation Error
Runtime Error

Doubts

Problems

Topic: Java ArrayList

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App