Jump to content

Recommended Posts

Posted

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

Posted (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 primitive

it's best you figure it out the best way to learn trust me

but I will give you some resources these are all you need

1) 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=54

Good java books

1) Absolute Java Savich (Beginners book)

2) Data Structures and Algorithms in Java (more advanced book)

Edited by ThinkAboutYou

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...