Use like bellow, You need escape Special characters
string.replace("\\","\");
Question
I tried using
string.replace("\","\");
But this doesn't work and gives me a compilation error
Syntax error on tokens, delete these tokens
Solution
Use like bellow, You need escape Special characters
string.replace("\\","\");
OTHER TIPS
escape the special characters.
string.replace("\\","\");
String p = ...;
p.replaceAll("\\\\", "\");
System.out.println(p);
use this code to replace and getting output in console..
Thanks..