可以试试:
writeText() {
Scanner Input = new Scanner(Systen.in);
System.out.println("enter a string: ");
String input = input.next();
File theFile = new File("thisfile.txt");
bw = new BufferedWriter(new FileWriter("thisfile.txt",true));
bw.write(input);
}