I’m reading in a file and storing it in t1. How do I access the elements in t1? When I try to print it I get addresses instead of values. Also whats the difference between String and String[]?
CSVReader reader = new CSVReader(new FileReader("src/new_acquisitions.csv"));
List <String[]> t1 = reader.readAll();
int i = 0
while(i < t1.size()) {
System.out.println(t1.get(i));
i++;
}
output:
[Ljava.lang.String;@9304b1
[Ljava.lang.String;@190d11
[Ljava.lang.String;@a90653
[Ljava.lang.String;@de6ced
String[] is an array of strings, hence the reason it is not printing as you would expect, try:
Or more concise:
Or better yet: