My code should read file and store each line(each record) into a String array.
My txt file is it:
FName Lname Number
second secondsecond 22
thired thithird 33
fourth fourfourr 44
fifth fiffif 55
but, when i run my code, my program do not display first character of each line! Show like this:
econd secondsecond 22
hired thithird 33
ourth fourfourr 44
ifth fiffif 55
My code:
public class ReadfileIntoArray {
String[] columns=new String[] {"FName","Lname","Number"};
String[] data=new String[100];
public void read() throws IOException{
FileReader fr=new FileReader("D:\\AllUserRecords.txt");
BufferedReader br=new BufferedReader(fr);
String line;
while((line=br.readLine())!=null){
for(int i=0;i<=br.read();i++){
data[i]=br.readLine();
System.out.println(data[i]);
}
}
br.close();
System.out.println("Data length: "+data.length);
}
public static void main(String[] args) throws IOException{
ReadfileIntoArray rfta=new ReadfileIntoArray();
rfta.read();
}
}
And i want see the data length:5 (because i have five line), But i see 100 !
(I want this information for abstract table model)
Thank You.