1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public class StringSplit { public static void main(String[] s) { String sentence = "The Java language was designed at Sun Microsystems over a five year " +"period, culminating in its first release in January 1996"; StringSplit st = new StringSplit(); st.split(sentence); } public void split(String sentence) { String[] words = sentence.split(" "); System.out.println("Words are:"); for(String word: words) { System.out.println(word); } } } |