'How to save file in folder on java?

How can I save a file in a selected folder in Java?
I need it like this: storage/emulated/0/myfile.txt
Is there is an example?



Solution 1:[1]

try (PrintWriter out = new PrintWriter("storage/emulated/0/myfile.txt")) {
    out.println(text);
}

If this is not what you want you'll have to add more details

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1