Originally posted by Harvinder Thakur:
Unless you add something to a collection the compiler sees no need to warn you because there are no chances of mixing your types. Isn't it?
Yes! And... The compiler can't warn you unless you used Generics there. You didn't use Generics here, so it is same as to writing like this:
In this case, you CAN put 'any' object to this array list. So no need to worry about the type safety here.
Devaka