Java List create from of method
import java.util.ArrayList; import java.util.List; import java.util.Map; public class Main { public static void main(String[] args){ List<String> jvmLanguages = List.of("Java", "Scala", "JRuby", "Groovy", "Jython", "Kotlin"); System.out.println(jvmLanguages); try {// w w w . j a va 2 s.com jvmLanguages.add("Exception"); } catch (UnsupportedOperationException uoe){ System.out.println(uoe); } } }