Did you mean CSV (Comma-separated Values)?
There is nothing in this code which should fail, but it does not look like you're trying to write a CSV file, it writes a single CSV line. The code is pretty bad. You hard-code everything using immediate constants. Take the constant of 5. What is there are more components? Why array of 5 values + 5 separate named variables. Do not Repeat Yourself (D.R.Y.). You read the variable and later put values in the array anyway. Instead of "" use
. Close file in the finally section of
block. Never use "
", use portable
Even better, use correct combination or
. You console input is ugly due to using only
As I understand from your comment, you wanted to append new data to the same file.
In this case, you should add boolean parameter
to the constructor of
(This is kind of bad; it you are a beginner, read help before using an existing class.
Please don't get offended, improve your approach, which should help you.)