Filesaver JavaFX

FileChooser fileChooser = new FileChooser();
 
//Set extension filter for text files
FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
fileChooser.getExtensionFilters().add(extFilter);

//Show save file dialog
File file = fileChooser.showSaveDialog(primaryStage);
//Its important towrite showSaveDialog!!!
Austrian Boiiiiiii