StringDemo2

package cn.zuoye;
/*
 * 需求:遍历获取字符串中的每一个字符
 *
 * 分析:
 *    a:拿到每一个字符串
 *    char charAt()
 *    b:字符串长度
 *    int length()
 */
public class StringDemo2 {
 public static void main(String[] args) {
 
  String s = "helloworld";
  for(int i=0;i<s.length();i++){
   System.out.println(s.charAt(i));
  }
 }
}
原文地址:https://www.cnblogs.com/rong123/p/9894447.html