foreach

作者: 筑梦丶 | 来源:发表于2018-10-05 15:29 被阅读0次

foreach语句格式:
  for(元素类型type 元素变量value : 遍历对象obj) {
    java语句;  
}

static void foreachString() {
        for (char c : "Tomorrow will be better".toCharArray()){
            print(c + " ");
        }
    }
    /* Output:
    T o m o r r o w   w i l l   b e   b e t t e r
    *///:~

相关文章

网友评论

      本文标题:foreach

      本文链接:https://www.haomeiwen.com/subject/zasqaftx.html