str = "Hello I'm your String"; String splited = str.split("\\s+");
Here is what the above code is Doing:
1. We’re creating a String object and assigning it to the variable str.
2. We’re calling the split() method on the str object.
3. We’re passing a regular expression to the split() method.
4. The regular expression is looking for one or more spaces.
5. The split() method returns an array of String objects.
6. We’re assigning the array to the variable splited.