This program creates 10 files on my desktop. The issue I am having is with the file names. The first one created is called "SecretFile1". The second is "SecretFile12". The third is "SecretFile123". What changes should I make so that the file names are "SecretFile1", "SecretFile2", and "SecretFile3" respectively?
import java.io.*;
public class TextFiles {
public static void main(String[] args) throws IOException {
String doc = "SecretFile";
int number = 0;
for(i = 1; i <= 10;i++){
number++;
doc = doc + number;
String name = "C:\\Users\\Soumil\\Desktop\\" + doc + ".txt";
BufferedWriter bw = new BufferedWriter(new FileWriter("" + name + ""));
bw.write("There's no secret.");
bw.close();
}
}
}