foreach循环
This commit is contained in:
parent
0d57276315
commit
f3cb1fe50d
@ -1,4 +1,17 @@
|
|||||||
package chapter6;
|
package chapter6;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Example05 {
|
public class Example05 {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ArrayList<String> list = new ArrayList<>();
|
||||||
|
list.add("A");
|
||||||
|
list.add("B");
|
||||||
|
list.add("C");
|
||||||
|
list.add("D");
|
||||||
|
|
||||||
|
for(String s : list){
|
||||||
|
System.out.println(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user