vicious Posted January 28, 2010 Posted January 28, 2010 hey guys, i'm not sure what the problem is here since i've seen many examples online done the exact same way as me(from what i can make out): ArrayList<String> list = new ArrayList<String>(); list.add( "item" );i get these errors when compiling:Bike.java:10: <identifier> expected list.add( "item" ); ^ Bike.java:10: illegal start of type list.add( "item" ); i know if i was using Integer or other types i would need to wrap them. but from what i've learned you don't with String since its not really a primitive Quote
ThinkAboutYou Posted January 30, 2010 Posted January 30, 2010 (edited) hey guys, i'm not sure what the problem is here since i've seen many examples online done the exact same way as me(from what i can make out): ArrayList<String> list = new ArrayList<String>(); list.add( "item" );i get these errors when compiling:Bike.java:10: <identifier> expected list.add( "item" ); ^ Bike.java:10: illegal start of type list.add( "item" ); i know if i was using Integer or other types i would need to wrap them. but from what i've learned you don't with String since its not really a primitiveit's best you figure it out the best way to learn trust mebut I will give you some resources these are all you need1) API sun java (everything you need to know) http://java.sun.com/j2se/1.5.0/docs/api/2) sun java forums http://forums.sun.com/forum.jspa?forumID=54Good java books1) Absolute Java Savich (Beginners book)2) Data Structures and Algorithms in Java (more advanced book) Edited January 30, 2010 by ThinkAboutYou Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.