Skip to content

Instantly share code, notes, and snippets.

@jumar
Created March 25, 2014 03:14
Show Gist options
  • Save jumar/9754602 to your computer and use it in GitHub Desktop.
Save jumar/9754602 to your computer and use it in GitHub Desktop.
Write string to file: one liner
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
public class StringToFile {
public static void main(String[] args) throws IOException {
String msg = "hello";
Files.write(Paths.get("./duke.txt"), msg.getBytes());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment