Input help

Hi,

I want to have a program that inputs a text file and on that text file there will be one name per line:

i. e.

James White

Alex Black

Michael Smith

etc. etc.

Then I want the program to read it line by line and assign each one a number. I cannot due that. How can i input the .txt file and have Java read it line by line, assigning each name a number?

[402 byte] By [bdan44a] at [2007-11-26 19:24:05]
# 1

http://onesearch.sun.com/search/onesearch/index.jsp?qt=how+to+read+a+text+file+line+by+line&subCat=&site=dev&dftab=&chooseCat=javaall&col=developer-forums

Should bring up loads of samples. By the way, you should read the IO tutorials.

http://java.sun.com/docs/books/tutorial/essential/io/

CeciNEstPasUnProgrammeura at 2007-7-9 21:46:27 > top of Java-index,Java Essentials,Java Programming...
# 2

thanks for your help. i have two other questions though.

1. How can I implement a file chooser. You know how on windows, on most apps, there is the option of browse and it brings up a file chooser. how can I do that?

2. How can i make it so that i can attach my file with its on ending, i.e. .xzy. I want to be able to save my file with an ending, like .xyz, so that it can be reopened later by my application.

bdan44a at 2007-7-9 21:46:27 > top of Java-index,Java Essentials,Java Programming...
# 3
1. http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html2. You can use whatever ending you like. If you want to know how to associate a specific suffix with your program ?that's an operating system issue.
quittea at 2007-7-9 21:46:27 > top of Java-index,Java Essentials,Java Programming...