The backslash is an escape character in Javastring literals. If you want to have a literal backslash in a string literal, you must write \\ instead of \.
Note also that you cannot put more than one character between single quotes (a char literal is exactly one character).
You cannot fit two characters: \' in a char literal, so you cannot use the replace() method that takes two chars.
If Java 1.1 doesn't have the replace() method that takes strings, then you'll have to program it yourself. Loop through the input string character by character, copy the characters to a StringBuffer, and when you encounter a ' in the input string, write \' to the StringBuffer. At the end call toString() on the StringBuffer to get the output string.