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
Secure Financial Transactions with Ansible, Terraform, and OpenSCAP
this week in the
Cloud/Virtualization
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Jeanne Boyarsky
Bear Bibeault
Sheriffs:
Rob Spoor
Henry Wong
Liutauras Vilda
Saloon Keepers:
Tim Moores
Carey Brown
Stephan van Hulst
Tim Holloway
Piet Souris
Bartenders:
Frits Walraven
Himai Minh
Jj Roberts
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(); } }
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
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...