A simple scenario in Java where replacing a single character with a back slash requires four back slashes
<p>Let's consider the following code snippet in Java.</p>

<pre><code>package escape;

final public class Main
{
    public static void main(String[] args)
    {            
         String s = "abc/xyz";
         System.out.println(s.replaceAll("/", "\\\\"));
    }
}
</code></pre>

<hr>

<p>I just want to replace "/" with "\" in the above String <strong>abc/xyz</strong> and which is done and displays <strong>abc\xyz</strong> as expected but I couldn't get why it requires back slashes four times. It looks like two back slashes are sufficient. Why such is not a case?</p>
