Saving a String to a Text File in Java

Asked 2 years ago, Updated 2 years ago, 115 views

Is there a way to save String as a text file in Java?

java file-io text-file

2022-09-22 22:33

1 Answers

I'm going to use PrintWriter PrintWriter out = new PrintWriter("filename.txt"); Create a file to write to.

out.println(text);

This is how you write it on the file. Write all the exception processing and files and call out.close().


2022-09-22 22:33

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.