String test = "My first arg test"; String[] words = test.split(" "); for (String word : words) System.out.println(word);