|
-
Mar 31st, 2010, 04:13 AM
#1
Thread Starter
New Member
Class List vs Interface List
Question:
In the java class libraries I saw there is a class List (java.lang.Object,extended by java.awt.Component,extended by java.awt.List)
as wel as the interface List(java.util ). Suppose you have imported both into one class. If you declare a variabele of type List (e.g. List list ; ) What is the type of list then? The interface List of the class List? Or does this depend on the initialisation?
-
Mar 31st, 2010, 04:21 AM
#2
Re: Class List vs Interface List
You cannot import both. You'll have to explicitly specify the class of each variable used. Or import one and have to use the full qualified name for the other on every use
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 31st, 2010, 04:36 AM
#3
Thread Starter
New Member
Re: Class List vs Interface List
I see, but how do you specify explicitly? Like this:java.lang.Object extended by java.awt.Component extended by java.awt.List List ?
-
Mar 31st, 2010, 04:38 AM
#4
Re: Class List vs Interface List
Code:
java.awt.List list = new java.awt.List();
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Mar 31st, 2010, 04:43 AM
#5
Thread Starter
New Member
Re: Class List vs Interface List
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|