It's not a secret anymore!
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
JavaRanch » Java Forums » Java » Java in General
Bookmark "Object Creation" Watch "Object Creation" New topic

Object Creation

susha pillu

Joined: Jul 25, 2001
Posts: 8
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:
subject: Object Creation
It's not a secret anymore!