how to read a specific line of a .dat file?
843785Dec 14 2008 — edited Dec 15 2008can we read a specific line of a .dat file, if so, how?
i have this .dat files for each customer, which contain their name on the first line, their id on the second line
and a list of items and an item id between each item.
John Doe
455689
milk
1
orange
9
Here is what I am trying to do, please correct me
...
//list out .dat file in dir
File customer_dir = new File ("Customer")
if (customer_dir.isDirectory())
{
String[] listofdat=dir.list();
}
for (int i=0;i<listofdat.length();i++)
{
Scanner dat_read = new Scanner (new File listfodat);
dat_read.nextLine();
if (dat_read.nextLine().equals("455689")) <--is this okay?
{
}