remove white space from string in java

remove white space from string in java
refer to‮ruttual:‬i.com
/**
 * @author lautturi.com 
 * Java example: removing whitespace from strings in java
 */


import java.util.*;

public class Lautturi {
	public static void main(String[] args) {

		String str = "  hello java 	\n  ";
		String newString = str.replaceAll("\\s+","");
		System.out.println(newString);
	}
}

output:

hellojava
Created Time:2017-10-07 17:37:59  Author:lautturi