here's the codes you needed just edit it for your self
and i know that it will help you and you can do it after i post it
Code:
 FileWriter key = new FileWriter("File");
  BufferedWriter kbd = new BufferedWriter(key);
  BufferedReader k = new BufferedReader(new InputStreamReader(System.in));
  System.out.println("Input: ");
  String input = k.readLine();
  
  kbd.write(input);
  kbd.close();
  
  //kbd.write("The");
  //kbd.write(" Zombie");
  //kbd.write(" Is there");
  //kbd.write(" NOW");
i almost forgot
this are to write
just change the write to read
if u want that ur prog will read the txt file that u made.

btw,
thank me if i helped you
if not its up to you :P