- package cn.hello;
- /*
- * 遍历获取字符串中的每一个字符
- * char charAt(int index)
- * */
- public class Test01 {
- public static void main(String[] args) {
- String s1="hello world take it easy ,so we can go there.";
- for(int i=0;i<s1.length();i++){
- System.out.print(s1.charAt(i)+", ");
- }
- }
- }
复制代码 |
|