import java.util.List; import java.util.ArrayList; import static java.util.Arrays.asList; public class StaticImports { public static void main(String[] args) { List<Integer> l=new ArrayList<>(asList(10,20,30)); System.out.println(l); } }
import java.util.List; import java.util.ArrayList; import static java.util.Arrays.asList; public class StaticImports { public static void main(String[] args) { ArrayList<Integer> al1=new ArrayList<>(); al1=asList(10,20,30);//Error: incompatible type System.out.println(al1); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)