Error in String.replaceAll() function
<p>I am trying the following code:-</p>

<pre><code>String x = "asdfg/dgws";
x.replaceAll("/", "\\");
</code></pre>

<p>But this is failing. This is giving me the following error message:-</p>

<pre><code>Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.charAt(Unknown Source)
    at java.util.regex.Matcher.appendReplacement(Unknown Source)
    at java.util.regex.Matcher.replaceAll(Unknown Source)
    at java.lang.String.replaceAll(Unknown Source)
    at com.jai.SecLargest.main(SecLargest.java:13)
</code></pre>

<p>I am not able to figure out why this exception is coming?</p>
