I am trying the following code:-
String x = "asdfg/dgws";
x.replaceAll("/", "\\");
But this is failing. This is giving me the following error message:-
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)
I am not able to figure out why this exception is coming?