You need:
str = str.replaceAll("World", "\\\\_\\\\_\\\\_\\\\_\\\\_");
Take a look.
\is the escape character in Java strings. So, to denote a literal \, you need to avoid it with another \like \\.
\is an escape char for the regex engine. Thus, a string \\in Java will be sent to the regex engine as \, which is not processed literally, but instead will be used to exit the next character.
\\ regex engine, \\\\ Java.
( ) , , replace String :
input = input.replace("World", "\\_\\_\\_\\_\\_");
.