What will be the result of the following code?
import java.util.*;
public class Test {
public static void main(String[] args) {
ArrayList<Integer> list = new ArrayList<>();
list.add(10);
list.add(20);
list.add(30);
list.add(40);
list.set(2, 50);
System.out.println(list);
}
}
[10, 20, 50, 40]
[10, 20, 30, 40]
[10, 20, 40, 50]
[50, 20, 30, 40]
This question is part of this quiz :
Java ArrayList