I have a string like this: John \\n Barber now I want to replace \\n with actual new line character so it will become
John \\n Barber
John
Barber<
You need to escape \ character. So try
\
replaceAll("\\\\n", "\n");