It depends what you want. Which writeInt() etc. methods are you using - i.e. what class?
If we're talking about java.io.ObjectOutputStream class, you have two choices for writing String. You can use writeObject(), as a String is an Object. Or you can use writeUTF(), which writes the String more compactly and is specific to String data.