This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can create a regular csv file with java.io.file package components. Or you can go after Apache POI and JExcelApi for Microsoft Excel file format. You may find lots of examples in the specified API documentation pages.
Assuming that you have to do it with your own code. Other wise you can export data with any pl/sql editor by hand.