how to convert string into words in java code example Example: string to words java String[] words = string.split("\\s+");