I want to generate CSV files. I have a generateCSV
method which takes a filename as parameters and a bunch of entries
private static void generateCSV(String pFilename, String... pColumns) {
try(FileWriter fileWriter = new FileWriter(pFilename,true)) {
for(String column : pColumns) {
fileWriter.append(column);
fileWriter.append(";");
}
fileWriter.append("\n");
fileWriter.flush();
}
catch (IOException e) {
e.printStackTrace();
}
}
When calling the method with generateCSV("myfile.csv")
without the entries i don't get any compilation error. I thought that this notation implies passing 1-N parameters from this object type. No ?