Hi all I have a CSV file like this:
 ban;frst_name;last_nam;adrs_provnc;accnt_type_id....
 ban1;frst_name1;last_nam1;adrs_provnc1;accnt_type_id....
 ....
I want to put this file into a datatype in which I can access each line as well as each field of everyline. Example: if I want the second line of the file then I should have --
"ban1;frst_name1;last_nam1;adrs_provnc1;accnt_type_id...."
And if I want the second field of second line I should have:
"frst_name1"
Is there a way I can do this , by which I can get access to both lines and fields.
This is what i coded
 public class cvsreader {    
List<List<String>> cust_data = new ArrayList<List<String>>(); // declared a list of list   
public void run() throws IOException {
    String cust_line = "";
    String delimeter = ";";
    String cust_inputfile = "C:/input.csv"; // input file
    BufferedReader cust_br = new BufferedReader(new FileReader(cust_inputfile));
    while ((cust_line = cust_br.readLine()) != null){
        cust_data = Arrays.asList(Arrays.asList(cust_line.split(delimeter))); // stored data from cust_line(string) to cust_data (list of list, so did type casting from list to array)
        System.out.println(cust_data);
        }
    }
}
it gives me output like below
[[ban,frst_name,last_nam,adrs_provnc,accnt_type_id....]]
[[ban1,frst_name1,last_nam1,adrs_provnc1,accnt_type_id....]]    
[[....                                                    ]]
now if i print
System.out.println(cust_data.get(0));
it gives output like this-
[ban,frst_name,last_nam,adrs_provnc,accnt_type_id....]    
[ban1,frst_name1,last_nam1,adrs_provnc1,accnt_type_id....]    
[....                                                    ]  
the one sqaure braces has been reduced but instead it should have given only the frst line.
[ban,frst_name,last_nam,adrs_provnc,accnt_type_id....]
and now if i print
System.out.println(cust_data.get(0).get(0));
it prints the below
ban    
ban1  
without square braces but instead it should have printed only the first field of first line that is-
ban.
please if anyone can now understand what actually has to be done to get desired result please suggest.
 
     
    