In K&B 6 book page no. - 597 under topic - The Legacy Way to Do Collections, it is written that A non-generic collection is quite happy to hold anything that is NOT a primitive. Whereas the following code works fine.
Please tell me is this an error in the book or I am misunderstanding something?
Astha - OCPJP 6 (90%)
posted 4 years ago
Remember auto-boxing. It looks like you're adding an int to the collection, but it's actually being converted to an Integer first.