I have 3 General questions on Generics typing and raw usage
1
List<Object> list = new ArrayList<String>();
Above code shows error , I think reason is generics not support polymorphism, right?
2
List list = new ArrayList<String>();
list.add("hello");
list.add(1);
But Above Code is fine , Why? Why it accept any object even i declared its as ArrayList of String.
3
List<String> a = new ArrayList<String>();
ArrayList<String> b = new ArrayList<String>();
in above, i heard that that a will perform better than b , this wrong right? since both woking on object of ArrayList,
assume ArrayList = implementation of List + extra methods