1String scientistName = "Isaac Newton";
2
3for (int i = 0; i < scientistName.length(); i++) {
4 System.out.print(scientistName.charAt(i) + " "); // I s a a c N e w t o n
5}
6
7//*********************************************************
8// you can cast a string into a char[]
9String str = "strings are not primitive types!";
10
11
12for (char ch : str.toCharArray()) {
13 System.out.print(scientistName.charAt(i) + " ");
14 }
15}
16
17
18
19
20