how to remove all whitespaces from string in javs code example Example: how to remove all whitespace from string java st = st.replaceAll("\\s+","")