Bookmark Topic Watch Topic
  • New Topic

writing string in file such that each token is on new line. Can you help?  RSS feed

 
yogesh raipure
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Report post to moderator
String source=name.getText()+age.getText()+city.getText();
i want to write this string source to file such that its written in a way given below:
name.getText()
age.getText()
city.getText()

that means i want each token to be written on new line.. can you help me out with the code??
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 37469
539
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Take a look at the PrintWriter class. It has a println method making it easy to write different data to different lines.
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Report post to moderator
This question seems so similar to your other two threads that I am closing it. You have already been told to use one thread per question.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!