Skip to content
Advertisement

I am not sure, why does my java buffered reader code only read last line of CSV file? [closed]

I’ve created a method that will read the contents of a CSV file and pass it through my object(bankaccount). I am not sure, why does it only read the last line of my csv file. Can any one figure it out/ or help me to read csv and convert it to java object?

My code:

JavaScript

CSV FIle:

JavaScript

Expected Output:

JavaScript

Advertisement

Answer

Just change your BankAccount attributes to non static because they belong to the instance

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement