This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Object Creation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object Creation" Watch "Object Creation" New topic
Author

Object Creation

susha pillu
Greenhorn

Joined: Jul 25, 2001
Posts: 8
Why
Collection l = new ArrayList();
is allowed but not
List l = new ArrayList();
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

If the error you get is:
l is already defined in [ wherever you've defined it ]

Then your problem is you've used the same variable name twice. Otherwise, I can compile this:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Object Creation
 
Similar Threads
ArrayList
Why in collection Objects are assigned to super reference
List implementation
passing List to method that wants ArrayList
What is the difference