File class has a method called delete. It deletes whatever file name you associate it with. If you give a directory name, then it will delete the directory if it's empty.
Usage is
File f = new File("test.txt");
f.delete();
This deletes the file in the working directory.
If you give a directory name for f, like
f = new File("\test");
It will delete the directory
test if it's empty.
Sudha