ProgramWindowJava

Declaring an array help

I am writing a program that will have a input file that will have a person's name and id number information on the file. I have to make this file my array for my program b/c the user will type in either the name of the person and have the id# returned or the user will enter the id# and the name will be returned. The problem I am having trouble with is when setting up the array which will be a 2-D array how do i set the size of the array to the number of entries in the file? The reason why I want to do this is incase the number of records the file has increases or decreases.

Replay:Declaring an array help
ArrayList
Check out this one.
This should do just what you want, since it's an array you can extend dynamically. You need to extend your array dynamically since there is now way to know beforehahnd how many lines a file has. With the ArrayList, you can just add a new entry each time you read a line. Since the ArrayList takes Objects in the add method, you can add other arrays as well, thus creating the 2d array you want.

There are more then enough methods in there to do what you want, just check it out.



Java

CMP and database connection problem
Need help with methods
Need help with this Code, please.
Threads
My first program.
memory address?
executable java file
Bitwise comparison?
Can't figure out Static Error?
Help!! using recursion to search an array
Encrypt / Decrypt homework help
Menus
help!!!!!!!!!!!!!!!
How to access JSpinner's JTextField?
easy questions
recursion/iterator problem
repainting the whole frame??
Help Wih Chessboard Problem
Format US currency
Applet:How do I get a background image.