1String s = "I want to walk my dog";
2String[] arr = s.split(" ");
3
4for ( String ss : arr) {
5 System.out.println(ss);
6}
1{
2public static void main(String args[])
3{
4String str = "Hey this is Ram";
5String [] words = str. split(" ", 3);
6for (String word : words)
7System. out. println(word);