View Single Post
  #1 (permalink)  
Old 07-07-2008, 01:56 AM
SCS17 SCS17 is offline
Member
 
Join Date: Nov 2007
Posts: 20
Rep Power: 0
SCS17 is on a distinguished road
Question FileOutputStream question...
hello all,

I have a question regarding Files and Streams. What happens if you dont close the stream that you are using with the close().. ??!
I know that the OS allows a limited number of files to be opened at a time depending on your RAM and all of that stuff, but I mean on the short term,, what are the consequences ???
I read that the file gets locked and you cant open it or delete it.. but I dont see any of that happens ??!

Thanks for the help.


import java.io.*;

public class example {

public static void main (String args[]) {

FileOutputStream out = new FileOutputStream("example.txt");

out.write('H');
out.write('E');
out.write('L');
out.write('L');
out.write('O');
// out.close() ... what happens if we dont call this method ??


}
}
Reply With Quote