int accountNumber[] = Integer.parseInt(account[count][1]);
int pinNumber[] = Integer.parseInt(account[count][2];
int balance[] = Integer.parseInt(account[count][3];
String name = account[count][4];
i dont know wat exactly r u doing here
u created account[] is a String Single Dimension array and we are accessing it as a double dimension array
-------------------------My View---
now u got the line from the File ri8
suppose say
12345 1234 200000 Jerry Lopez
step1 : split the line with space as delimiter
and write each in a String array ,
say names(array name) names[0]=jerryu Lopez
names[1]=200000
names[2]=1234
names[3]=12345
step2: Now Create an HashMap map =new HashMap();
map.put(names[0],names[1]);
map.put(names[0],names[2]);
map.put(names[0],names[3]);
Read Hash map For this
Now list The entires in hash map using the map name .. "names[0]"
Originally Posted by
l_03
hello guyzz,,,i am almost finished with my code,,but our teacher require us to access a text file..this is it:
in my text file:
accountList.txt
12345 1234 200000 Jerry Lopez
first column was accountNumber, then the pinNumber, then the balance and the name..
what i did was...
import java.io.*;
public class BankAccount{
public void account(){
File ACCOUNT = new File ("accountList.txt");
FileReader fr = new FileReader(FROZEN);
Reader reader1 = new BufferedReader (fr);
LineNumberReader lnr = new LineNumberReader (reader1);
String line;
for (line = lnr.readLine(); line!=null; line = lnr.readLine()){
String account[] = new String[4];
int count = 0;
int accountNumber[] = Integer.parseInt(account[count][1]);
int pinNumber[] = Integer.parseInt(account[count][2];
int balance[] = Integer.parseInt(account[count][3];
String name = account[count][4];
System.out.println(accountNumber[0][1]);
}
}
i want to sysout the accountNumber,,which is
12345
it has no error when i run it,,but i dont really know what is the problem...
it only print out
0
and i dont know why zero,,,,it seems there is a problem when i declare it...
help guyzzz...i really need your help because we are about to pass it next week,,,,
"that is a shortcut,,i already have the main method.."