So far I have this:
File dir = new File(\"C:\\\\Users\\\\User\\\\Desktop\\\\dir\\\\dir1\\\\dir2);
dir.mkdirs();
File file = new File(dir, \"filename.txt\");
try {
PrintWriter outputStream = new PrintWriter("myObjects.txt");
outputStream.println(String.format("%-20s %-20s %-20s", "Name", "Age", "Gender"));
outputStream.println(String.format("%-20s %-20s %-20s", "John", "30", "Male"));
outputStream.close();
} catch (IOException e) {
e.printStackTrace();
}