I want to copy the content of file \'A\' to file \'B\'. after the copying is done I want to clear the content of file \'A\' and want to write on it from its beginning. I can
If you don't need to use the writer afterwards the shortest and cleanest way to do it would be like that:
new FileWriter("/path/to/your/file.txt").close();