View Single Post
Join Date: Oct 2008
Posts: 37
Reputation: l_03 has a little shameless behaviour in the past 
Solved Threads: 0
l_03 l_03 is offline Offline
Light Poster

Re: How to make an array in text file (help..)

 
0
  #8
Nov 17th, 2008
Originally Posted by javaAddict View Post
  1. for (line = lnr.readLine(); line!=null; line = lnr.readLine()){
  2.  
  3. String account[] = line.split(" ");
  4.  
  5. //print whatever you want
  6. //and do whatever you want with the elements:
  7. //account[0], account[1], account[2], account[3], account[4]
  8.  
  9. }


for (line = lnr.readLine(); line!=null; line = lnr.readLine()){

String account[] = line.split(" ");

//print whatever you want
//and do whatever you want with the elements:
//account[0], account[1], account[2], account[3], account[4]

}

hello, i have tried what you told me...

but when i print
System.out.println(account[0]);

it prints the whole line which is:

12345 1234 200000 Jerry Lopez

i think this is a two dimensional array...

i only want to print out the 12345...but i am really confused either....

thank you in advance........


what if i have this in my accountList.txt...
12345 1234 200000 Jerry Lopez
23456 2345 45666 Letty Mae

what if i want to print out the 23456?????....

i am really confused either...maybe i am not that good in text file and how to make arrays
with it....

i hope you can help me...
Reply With Quote