Link to home
Start Free TrialLog in
Avatar of meow00
meow00

asked on

output files in java.


 Hello experts,

     I tried to output a String to a file in the following way.
   ------------------------------
   String myData = " a lot of data here";
   FileWriter outFile = new FileWriter(new File("result.txt"));
   outFile.write(myData);
 -----------------------------------
   but my "result.txt" is empty. Does anyone know what I did wrong ? Thanks.
       
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And as a good practice, close () in finally blocks.