Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Java in General
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
High Performance Python for Data Analytics
this week in the
Python
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Paul Clapham
Ron McLeod
Bear Bibeault
Liutauras Vilda
Sheriffs:
Jeanne Boyarsky
Tim Cooke
Junilu Lacar
Saloon Keepers:
Tim Moores
Tim Holloway
Stephan van Hulst
Jj Roberts
Carey Brown
Bartenders:
salvin francis
Frits Walraven
Piet Souris
Forum:
Java in General
Object Creation
susha pillu
Greenhorn
Posts: 8
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Why
Collection l = new ArrayList();
is allowed but not
List l = new ArrayList();
Mike Curwen
Ranch Hand
Posts: 3695
I like...
posted 19 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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:
import java.util.*; public class TestCollection { public static void main(String args[]) { TestCollection app = new TestCollection(); app.DoIt(); } void DoIt() { Collection c = new ArrayList(); List l = new ArrayList(); } }
Look ma! I'm selling my stuff!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Why in collection Objects are assigned to super reference
passing List to method that wants ArrayList
What is the difference
List implementation
ArrayList
More...