PDA

View Full Version : Java Question



numba1xclusive
03-28-2005, 10:17 PM
Ok, I have to write a prgm that basically finds the age of each "passenger" on this fictional ship. I'm using a buffered reader, and I have to use Arrays. my problem comes, how do I tell it to find an int? The line of the txt file looks somewhat like this. there are 250 names.

ARLE Susan 21 London Female Penitentiary,Pentonville.

I'm seriously a Java noob.. :mellow:

Entity101
03-29-2005, 02:32 PM
Read a single line (one person) using readLine()

Use a StringTokanizer to split this string in multiple strings (using the space a splitting point).

Third string is the age. Create a new Integer from the String and use intValue() to get an int.

http://java.sun.com/j2se/1.4.2/docs/api/index.html