Prav wrote:If its like that then what does the RHS of second declaration conveys? Doesn't it serve any purpose?
It is serving its purpose na, but in this case it is not deciding what can be added.
Reference type always restricts what you can assign to this reference type, and what can you add if reference type is collection, or what method can be called. This is the power of reference type, RHS is a small child against the power of LHS, LHS says what is possible and what is not always.
List<String> list1 = new ArrayList(); //warning
Here also its reference type is scolding RHS why it is assigning such an ArrayList(), that has no parameter restriction.