Monday, January 10, 2022

File Handling Program In BlueJ Using FileWriter Class

 
import java.io.*;
import java.util.*;
class B
{
   String str;
   Scanner sc=new Scanner(System.in);
    FileWriter fw;  
    
    void take() throws Exception
    {      
       fw    =new FileWriter("E:/myfile.txt");
    System.out.print("\nEnter The sentence: ");
        str=sc.nextLine();                
       fw.write(str);
       fw.close();
    }       
   }

No comments:

Post a Comment

Subscribe via email

Enter your email address:

Delivered by FeedBurner