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 will be the output of the following C code? #include <stdio.h> void main() { int lookup[100] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; printf("%d", lookup[3]); } On UNIX, statements entered in 'MySQL' are saved in which file? What will be the output of the following Java program? class area { int width; int length; int volume; area() { width=5; length=6; } void volume() { volume = width*length*height; } } class cons_method { public static void main(String args[]) { area obj = new area(); obj.volume(); System.out.println(obj.volume); } } Which emerging trend focuses on the application of data science and AI to improve the accessibility and inclusivity of digital products? What is the purpose of the str() function in Python?