You want to save strings stored in an array as a text file. I don't know what to do.
java
String[] texts = ...
//FileOutoutStream fos = newFileOutputStream ("file path to save");
// If you want to save bytes
// With Java 8's autoclose:
try(FileWiterfout=newFileWriter("file path to save") {
PrintWriter out = new PrintWriter(fout);
for( String line:texts ) {
out.println(line);
}
}
Shouldn't we do it like above?
Study the similar classes above. Depending on the type of use, there are various classes and methods.
© 2024 OneMinuteCode. All rights reserved.