File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes ArrayList issues adding integers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayList issues adding integers" Watch "ArrayList issues adding integers" New topic
Author

ArrayList issues adding integers

Michael Comerford
Greenhorn

Joined: Jan 16, 2010
Posts: 13
Hi there,

I'm trying to create an arraylist of arraylists as a data structure to represent demographic data.

I've hit a brick wall already, when I try to add integers to one of my arraylists I get errors.

I'm using Eclipse and this program is for JavaSE 1.6

here's the code...

Eclipse tells me that there is:
Multiple markers at this line
- Syntax error on token(s), misplaced construct(s)
- Syntax error on token "id1", VariableDeclaratorId expected after this
token

at the lines that start caseid.add

Any help greatly appreciated!

Michael

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4246
    
    7

Hi Michael. Welcome to The Ranch!

Your main problem there is that you're trying to add instructions directly to a class, rather than them being in a method. The declarations would work (but probably aren't what you intended - there's no reason for id1-id5 to be member variables). But the add lines have to be in a method (or at least an initialisation block).
Michael Comerford
Greenhorn

Joined: Jan 16, 2010
Posts: 13
Doh! Silly mistake, thanks Matthew!

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ArrayList issues adding integers
 
Similar Threads
Vector and Array please help
Custom Class as Key for Hash Map
how to insert multiple value in database
outputing an arraylist of arraylists to a file.
argument in form access