posted 15 years ago
You're creating an instance of the class ArrayList, and you're holding it in a variable of type "Collection". This is like buying a pet of type "Goldfish" and putting it in a fish tank. You can't buy a "Fish" -- you can only buy an Angelfish, a Goldfish, a Guppy, etc. But the tank can hold any kind of Fish.
A Collection variable can hold any kind of Collection -- and ArrayList, which implements List which extends Collection, is a kind of Collection.