• Post Reply Bookmark Topic Watch Topic
  • New Topic

Array List from a text file  RSS feed

 
Simon Leigh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
hope this is the right place to post!
My question is i have a text file with 10 lines, each line has different parts eg name, age, height etc, want i want to do is create an array so each line has its own array 'box'
eg
line one of the text file goes into array position 0
line two goes into array position 1
etc etc
Any help would be great!

many thanks...............
 
Henry Wong
author
Sheriff
Posts: 23295
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Standard homework problem... The easiest way to start this is probably to just start it -- don't worry about the design or optimizing it, etc.

Do you know how to open and read files? Do you know how create arrays? Do you learned to do loops yet? Take a shot at the assignment, but make sure to read up on files, arrays, and loops, from your text book, if you get confused.

Henry
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome the the Ranch
 
Max Rahder
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apache Commons has some handy IO utilities. Apache Commons IO
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you intend to create objects to encapsulate all those variables from the text file?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!