Worked example
String[] names = {"Ada", "Sam", "Kai"};
int[] scores = {88, 91, 75};
PrintWriter out = new PrintWriter(System.out);
for (int i = 0; i < names.length; i++) {
out.println(names[i] + "," + scores[i]);
}
out.flush();
Each pass writes one CSV line: Ada,88, then Sam,91, then Kai,75.