String i/p - Hello\n world!! \nWelcome!!
Op -
 Hello
 World!!
 Welcome!!
If \n occurs word will be printed on the next line.
There is no need for a regular expression when wanting to replace one exact thing with one other exact thing, of course.
String in = "Hello\\nworld!!\\nWelcome!!";
String out = in.replace("\\n", "\n");
System.out.println(out);
> Hello
> World!!
> Welcome!!
If you want blank lines in between, replace with "\n\n" instead.
\\n should be escaped like \\\\nreplace, not replaceAll.