1. public static void arrayLoopRefactoring()
2. {
3. int[] myArray = {1 , 2 , 3 , 4} ;
4. for(int x = 0 ; x < myArray.length ; x++) {
5. System.out.println(myArray[x]) ;
6. }
7. }
1. public static void arrayLoopRefactoring()
2. {
3. int[] myArray = {1 , 2 , 3 , 4} ;
4. for(int item : myArray) {
5. System.out.println(item) ;
6. }
7. }
進入討論組討論。 新聞熱點
疑難解答