title: \n and \\s+ not working in Java
body: <p>So I'm an IB student and I'm taking Comp. Sci. we need to create a code to solve a problem, as i was writing my Java code I found the <code>String.replaceAll();</code> that is helpful in writing my code. I had to remove any white spaces, and any new lines, so I found <code>\\s+</code> and <code>\\n</code>. So as I enter the code <code>String.replaceAll("\\s+","");</code> it didn't work, same with <code>String.replaceAll("\\n","");</code>. I have tried removing the " " but BlueJ, sends an error saying that <code>\</code> is an illegal character. I checked if maybe the <code>String.replaceAll();</code> doesn't works but it does work, so I came to a conclusion that something is wrong with <code>\\s+</code> and <code>\\n</code>. </p>
  
  <p>I have found an alternative in removing white spaces <code>String.replaceAll(" ","");</code>, but I still need a way to remove new lines.</p>
  
  <p>Here is a part of the code</p>
  
  <pre><code>String name = InputString("Enter name: ");
  String name1 = name.replaceAll("\\s+","");
     output(name1); // the output function is located in the IBIO which is provided because I'm and IB student
  </code></pre>
  
  <p>Alright so someone had given me a code that will remove all of the new lines <code>\\n</code>, but if people can give me the reason why my <code>\\s+</code> not working that would be helpful.</p>