The above code generates an error .. why ??
i know that Collection is an interface and List is also an interface which inherits from Collection and Arraylist is an implimentation of List then why the error??
even the site http://www.javamex.com/tutorials/collections/using_1.shtml is using it this way ... am i missing anything ??
Beware of imports in IDEs. If you write L-i-s-ctrl-space in Eclipse®, it will expand it to anything beginning with Lis, including java.awt.List and java.util.List. It displays the options in alphabetical order, so awt comes before util, and you can very easily pick the wrong List.