Skip to content
Quiz · Collections and generics · lesson 6 of 13

Quiz — add to List.of

What happens when this program is compiled and run?

JAVA
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<String> xs = List.of("a");
        xs.add("b");
        System.out.println(xs);
    }
}