Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

string manipulation

 
pvsr rao
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have one string.i have to create a one file and copy the string into that file.how to do this.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This sounds like file manipulation, not String manipulation. To create a file and write to it, you should use either FileOutputStream or FileWriter. See the link to the Java tutorial in my signature for some information about these and other input and output stream classes.

Layne
 
Akshay Kiran
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to write something on file is called serialization
(your topic could have been "writing a string on file" rather than "string manipulation")
to read/write from files, you need to first import the
java.io package
and then use the classes to open the desired file and write the string at hand onto it.
I think you are new to I/O and I suggest you do a bit of reading before asking for a solution directly. Try searching the I/O forum and make a beginning with the java tutorial.

happy programming
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic