Hi,\n\nI have string\n\nString s = "Hello \"World\"";\n\nwhen i print this on console, it prints\n\nHello "World"\n\nIt works fine. Now what i want to is to print\n\nHello \"World\"\n\nWhich means i have to replace the quotes (") with (\\) and then a\nquote so that i may get a quote in output. so i used replaceAll method\n\nSystem.out.println(s.replaceAll("\"", "\\\""));\n\nBut to my astonish, it prints out\n\nHello "World".\n\nI wondered and then tried to do it again with\n\nSystem.out.println(s.replaceAll("\"", "\\\\\""));\n\nNow i was able to see the desired outout i.e; Hello \"World\"\n\nBut why i have to use 5 back slashes instead of 3 which were according\nto the logic of "backsequences"?? I have seen the replaceAll method\nand it is using the pattern matching in it.\n\nIf i try to replace the string using simple "replace" method it works\nfine; i.e i don't have to use 5 backslashes, i use only 3 (according\nto logic). Can someone explain why i have to use 5 slasheds in\nreplaceAll.