stringsSplit=string.split(" "); for (String s:stringsSplit) System.out.print(s+" ");