package bankaccountapp;
import java.io.*;
import java.util.*;
public class Csv {
public static void main(String args[]){
List<String[]> accounts=new LinkedList<String[]>();
String data;
try {
BufferedReader br = new BufferedReader(
new FileReader(
"C:\\Users\\RaviKiran Reddy\\Desktop\\JBNR\\NewBankAccounts.csv"));
while ((data=br.readLine())!= null) {
String[] datarows=data.split(",");
accounts.add(datarows);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e1) {
e1.printStackTrace();
}
System.out.println(accounts);
}
When I try to read a CSV file by splitting it using commas I am getting the object code (like [Ljava.lang.String;@7382f612
) as output, but not the strings as I expected.
If this is the line: Deadra Power,009545701,Checking,4500
then I am expecting the output as: \n Deadra Power \n 009545701 \n Checking \n 4500
.
Can I know where the error is?