Public class Record{
public static void main(String[] args) {
try {
String data = "Получилось!";
FileWriter fWriter = new FileWriter("C:\\Users\\handi\\OneDrive\\Рабочий стол\\новый.txt");
fWriter.write(data);
}
catch ( IOException e ) {
e.printStackTrace();
}