How does java generics syntax help avoid type casting?
问题 Below is the code, import java.util.List; import java.util.ArrayList; public class Dummy { public static void main(String[] args) { List<String> lst = new ArrayList<String>(); lst.add("a string"); lst.add("another string"); String s = lst.get(0); } //end main } when the constructor new ArrayList<String>(); is invoked, array of type Object is created. .. lst holds Object[0] array. So, If array of type Object gets created by constructor, How does javac does not see type casting issue in this