title: White Spaces Java Text File
body: <p>Is is possible to remove the white spaces of a <code>String</code> in a text file in Java? I have tried my approach but doesn't working.</p>
  
  <pre><code>public static void main(String[] args) throws IOException {
      File f = new File("ejer2.txt");
      BufferedReader br = new BufferedReader(new FileReader(f));
      String linea = br.readLine();
      linea.replaceAll("\\s", "");
      while (linea != null) {
          System.out.println(linea);
          linea = br.readLine();
      }
      br.close();
  }
  </code></pre>
  
  <p>The only way I can get the white spaces out of the <code>String</code> is when I print the line out in the <code>While</code> loop by using the <code>replaceAll</code> method in the <code>String</code> class, but im trying to take them out of the <code>String</code>in the <code>File</code>, and I'm not sure if this is possible.</p>