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));
  }
 }
}
posted @ 2018-11-02 09:32  阿蓉  阅读(86)  评论(0编辑  收藏  举报