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
One of the best companion for java is Apache Projects and please do refer to it. For file related operation you can refer to the Commons IO project.
The Below one line code will help us to make the file empty.
FileUtils.write(new File("/your/file/path"), "")