Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2008-06-12
3
814 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

839 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