java replacing back strokes with other characters

I have come across this little problem.

    String fileAdress = "c:\red\";
    System.out.println("Peach " + fileAdress);
    fileAdress = fileAdress.replaceAll("\", "\\\\");
    System.out.println("Steel " + fileAdress);

or

    String fileAdress = "c:\\red\\";
    System.out.println("Peach " + fileAdress);
    fileAdress = fileAdress.replaceAll("\\", "\\\\");
    System.out.println("Steel " + fileAdress);

I would like to convert the fileAddress to be to the following

    String fileAdress = "c:\\\\red\\\\";

Would it be possible to advise of where I am making the error and how to resolve it?

Jon Skeet
people
quotationmark

Use replace instead of replaceAll - replaceAll takes a regular expression as the first argument, which isn't what you want. This should be fine:

fileAddress = fileAddress.replace("\\", "\\\\");

(I wish replaceAll had been called regexReplace or something more obvious - this problem comes up a lot.)

people

See more on this question at Stackoverflow