Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

how to save a string to a text file

Path path = Paths.get("output.txt");
String contents = "Hello";

try {
    Files.writeString(path, contents, StandardCharsets.UTF_8);
} catch (IOException ex) {
	// Handle exception
}
Source by stackabuse.com #
 
PREVIOUS NEXT
Tagged: #save #string #text #file
ADD COMMENT
Topic
Name
8+5 =