Quick! Writing to text file.
Hello, so I'm trying to write to a text file. Each time I run the program any previous data in the text file gets deleted.
Everything was declared above. Currently fileName input is "x" without quotes
Code:
fileName = JOptionPane.showInputDialog("Please Input File Name with .txt extension: ");
filex = new File(fileName+".txt");
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(filex));
if(filex.exists()){x=1; System.out.println("aaaaaaa");}
if(!filex.exists() && filex.getName()!=null && filex.getName()!=""){filex.createNewFile();JOptionPane.showMessageDialog(null, "File Didn't exist. File Created!");}
if(filex.getName()==""){System.exit(0);}
Re: Quick! Writing to text file.
Re: Quick! Writing to text file.
WELL...I feel stupid! Thanks a lot!!!! adding ,true solved it.
Re: Quick! Writing to text file.
You're welcome. You can't know every method signature in the API docs :)