I have created an executable jar file. User is required to put in his/her name and save it in order to proceed. This requires creation of a file, but due to *.txt at gitignore it will not be stored in git. I would like to know the proper way to create a file, so that user will be able to put in his name and proceed. What should I add besides:
File yourFile = new File("Name.txt");
yourFile.createNewFile();
FileOutputStream oFile = new FileOutputStream(yourFile, false);
try {
BufferedWriter reader = new BufferedWriter(new FileWriter(new File("Name.txt"), true));
reader.write(Data);
reader.newLine();
reader.close();
} catch (IOException E) {
System.out.println("Error is " + E);
}