I'm working on a code that takes in a couple of inputs and re-write them into a .txt file of my creation but to my dismay the output file can not contain a line-breaker even with the appropriate formatting. I'm using Formatter(java.util)
public void file(Scanner s, Formatter f){
String s1 = s.nextLine();
if (!"end".equals(s1)){
f.format("%s\n%s", s1, " ");
file(s,f);
}
f.close();
}
public void file(Scanner input,Formatter f,int state){
String s1 = input.nextLine();
int loopStop = 0;
if (state == 1){
file(input, f);
} else {
while (!"end".equals(s1) && loopStop<11){
f.format("%s\n\n%s", s1, " ");
s1 = input.nextLine();
loopStop++;
}
f.close();
}
}