Hi. Im trying to write specific text in a .txt file

that file would be imported inside a folder

I use this to create a file or folder

File folder = new File("d:"+IN.getText());

          if (folder.mkdir()){
            System.out.println("Batch is created!");
            System.out.println("This batch already exists.");

can create a .txt with a simple change of code. but Im not sure how to write in that file. for ex: IN=Invoice Number = 1241241
I dont know how to make the write string, can someone help?

I know there are planty of results in google but none of them helped enough.

Use a PrintStream

Just create a PrintStream using your File and print to it just like you print to System.out
Something like:

File out = new File( etc etc);
PrintStream p = new PrintStream(out);
p.println("Invoice no=" + invoiceNum);