Home / MCQ Bank / Computer
Computer Collections Framework In Java

What will be the output of the following Java program? import java.util.*; class Arraylist { public static void main(String args[]) { ArrayList obj = new ArrayList(); obj.add("A"); obj.add("B"); obj.add("C"); obj.add(1, "D"); System.out.println(obj); } }

Select the best option to verify your answer:
Show Correct Answer
Correct Answer: Option B • [A, D, B, C]

Related Computer Questions

What does vlink mean? In an application created using the database wizard, the main menu is presented as a: If a problem can be solved by combining optimal solutions to non-overlapping problems, the strategy is called ______ What is method overriding in Java? What is the purpose of the `RandomAccessFile` class in Java?