JAVA中的for循環幾種使用方法

通常寫法 1: 遍歷數組的傳統方式 /* 創建一個數組 */ int [] integers={1,2,3,4}; /* 開始遍歷 */ for (int j=0;j<integers.length;j++){ int i = integers[j]; System.out.println(i); } 2:遍歷Collection對象的傳統方式 /* 創建一個Collection */
相關文章
相關標籤/搜索