I have written a test program to take in values from a csv file, using the openCSV library.
My problem lies in reading the values from the file, and then displaying them as an output. I can iterate through the list, but am constantly given machine code as the value, instead of the intended String value.
Below is the test code, any advice would be most appreciated.
public class TestParse{
public static void main(String[] args){
try{
CSVReader reader = new CSVReader(new FileReader("weightMeasurements2.rtf"));
List<String[]> myEntries = reader.readAll();
Iterator<String[]> flavoursIter = myEntries.iterator();
while ( flavoursIter.hasNext() ){
System.out.println( flavoursIter.next() );
}
for (int i = 0; i<myEntries.size();i++) {
System.out.println(myEntries.get(i));
}
}catch(IOException e){
e.printStackTrace();
}
}
}
Each of the elements in your
Listis an array. To print this, you need one loop inside the other. For example: