import java.io.*;
public class Random {
public static void main(String[] args) {
RandomAccessFile io= null;
String text ="Hallo ihr wie gehts?";
try
{
io = new RandomAccessFile("io.txt", "rw");
io.seek(0);
io.writeChars(text);
io.close();
}
catch (IOException e){
System.out.println(e.toString());
}
}
}
PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter("test.txt")));
writer .println("Hallo wie geht es dir?");
writer .flush();
writer .close();