Solved

Need to loop through a text file and load data into an array

Posted on 2008-06-12
3
808 Views
Last Modified: 2013-11-23
I have a text file that I need to loop through and put the data into 2 seperate arrays.
For instance the data will look like this..
Mary Jones 16
How can I tell when I reach the end of the file.

This is what I have so far, I know its not much but Im still pretty new to Java.

Scanner inFile = new Scanner(new FileReader("Player.txt"));
0
Comment
Question by:monica73174
  • 2
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 500 total points
ID: 21775964
following shows how to read a file line by line

http://www.objects.com.au/java/qa/1052695124.html
0
 
LVL 92

Assisted Solution

by:objects
objects earned 500 total points
ID: 21775965
readLine() returns null when eof is reached

0
 

Author Closing Comment

by:monica73174
ID: 31466816
thanks
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven project error 5 56
oracle 11g 23 84
factorial example 4 40
login jsp example 24 51
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question