Deposit & Withdraw | About Verified Sellers and Escrow | Advertise | Scam Report | Tracking Number Details | WesternUnion Tracking

carding forums carding forums
revolut carding carding forums
carding forums carding forums
carding forums

Thread Rating:
Read and write file in Java
#1
PHP Code:
        // get which file you want to read and write
        
File file = new File("D://test.txt");
 
        try {
 
            
// check whether the file is existed or not
            
if (file.exists()) {
 
                
// create a new file if the file is not existed
                
file.createNewFile();
            }
 
            
// new a writer and point the writer to the file
            
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
 
            
// writer the content to the file
            
writer.write("I write something to a file.");
 
            
// always remember to close the writer
            
writer.close();
            
writer null;
        } catch (
IOException e) {
            
e.printStackTrace();
        }
 
        try {
 
            
// new a reader and point the reader to the file
            
BufferedReader reader = new BufferedReader(new FileReader(file));
 
            
String line "";
            
System.out.println("Content of the file\n================================");
            while ((
line reader.readLine()) != null) {
                
System.out.println(line);
            }
            
reader.close();
            
reader null;
        } catch (
FileNotFoundException e) {
            
e.printStackTrace();
        } catch (
IOException e) {
            
e.printStackTrace();
        } 
Reply
Paid adv. expire in 47 days
CLICK to buy Advertisement !

    Verified & Trusted HACKED Payza, PayPal, Ukash, Ucard, EgoPay, Skrill - TRANSFER [Escrow accepted]

#2
Thank you.
Reply
  


Forum Jump:


Contributors: ramziy , mruNN