What will be the output of the following code?

Last Updated :
Discuss
Comments

What will be the output of the following code?

Java
import java.util.*; public class Test {     public static void main(String[] args) {         ArrayList<String> list = new ArrayList<>();         list.add("Apple");         list.add("Banana");         list.add("Cherry");         list.add("Date");         list.remove("Banana");         System.out.println(list);     } } 


[Apple, Cherry, Date]


[Apple, Banana, Cherry, Date]


[Banana, Apple, Cherry, Date]

[Apple, Cherry, Date, Banana]

Share your thoughts in the comments