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
*///:~
网友评论