Premetto che con JAVA sono agli inizi!!!

CMQ in questo modo scrivi una stringa di testo su un file


codice:
import java.io.*;

class scrivi{
    public static void main(String args[]) throws Exception{
        String source = "Output su file in Java\n";
        char buffer[] = new char[source.length()];
        source.getChars(0, source.length(), buffer, 0);
        FileWriter f0 = new FileWriter("fileProva.txt");
        f0.write(buffer);
        f0.close();
    }
}
Ora cerco anche il modo per leggere un file (poi ti faccio sapere)

Ciao