public class SimpleTesting{ public static void main(String[] args) { String str = "Hello This is DelfStack"; String[] newStr = str.split("\\s+"); for (int i = 0; i < newStr.length; i++) { System.out.println(newStr[i]); } } }