In Java, I have text from a text field in a String variable called \"text\".
How can I save the contents of the \"text\" variable to a file?
Use this, it is very readable:
import java.nio.file.Files; import java.nio.file.Paths; Files.write(Paths.get(path), lines.getBytes(), StandardOpenOption.WRITE);