Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old May 7th, 2008, 12:49 PM
sharwei sharwei is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 122 sharwei Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 15 h 3 m 30 sec
Reputation Power: 0
List Help

I'm extremely new to Java, so having some syntax issues. I'm trying to learn some data structures, and getting an error. Not sure why....

Code:
import java.util.List;

public class MyList {
	public static void main(String[] args) {
		List<String> l = new List<String>();
                l.add("HELLO WORLD");
       }
}


On the first line in main() I get this error:
Cannot instantiate the type List<String>

Anybody know what this means? Any help would be greatly appreciated...

Reply With Quote
  #2  
Old May 7th, 2008, 12:56 PM
crownjewel82's Avatar
crownjewel82 crownjewel82 is offline
rebel with a cause
Dev Shed God (5000 - 5499 posts)
 
Join Date: May 2004
Location: The Batsh!t Crazy State.
Posts: 5,349 crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)crownjewel82 User rank is General 14th Grade (Above 100000 Reputation Level)  Folding Points: 32123 Folding Title: Starter FolderFolding Points: 32123 Folding Title: Starter Folder
Time spent in forums: 2 Months 3 Weeks 4 Days 16 h 11 m 14 sec
Reputation Power: 1935
List is an interface. You can't instantiate interfaces. In order to get an instance you must use an implementing class such as LinkedList or ArrayList.

Java Collections Tutorial
Comments on this post
Yawmark agrees!
__________________
The day I get my hands on the cookbook it's all over. -nicky

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > List Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway