title: How do I replace line break with "\n" with java?
body: <p>I want to replace newline with "\n" but my code isn't working.</p>
  
  <pre><code>str.replaceAll("\n","\n"));
  </code></pre>
  
  <p>Expected: "Hello\n World"</p>
  
  <p>Actual: </p>
  
  <p>"Hello</p>
  
  <p>World"</p>