File Writing

mail@pastecode.io avatar
unknown
java
a month ago
559 B
2
Indexable
Never
package writingafile;
import java.io.FileWriter;
import java.io.IOException;
public class Writingafile 
{
    public static void main(String[] args) 
    {
        try
        {
            FileWriter obj=new FileWriter("theerdha1.txt");
            obj.write("hello its my first file" );
            obj.close();
            
        }
        catch(IOException e)
        {
            System.out.println(e);
        }
        finally
        {
            System.out.println("successfully write to a file");
        }
    }
    
}
Leave a Comment