TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Write in Text File in Java Program
Alagunila Meganathan
Aug 03
2016
Code
461
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
WriteTextFileExample
import
java.io.*;
public
class
WriteTextFileExample{
public
static
void
main(String[] args)
throws
IOException{
Writer output =
null
;
String text =
"Rajesh Kumar"
;
File file =
new
File(
"write.txt"
);
output =
new
BufferedWriter(
new
FileWriter(file));
output.write(text);
output.close();
System.out.println(
"Your file has been written"
);
}
}
JAva
File
write