[Java 教學範例拷貝]- 進階的陣列觀念 (2/4)
[Java 教學範例拷貝]- 進階的陣列觀念 (2/4)
剛才找資料時發現一個的Java 教學網站,趕快發揮(C/P)的長才將它備份來,有需要的同好,歡迎來(C/P)一下^^。
拷貝來源:
http://openhome.cc/Gossip/JavaGossip-V1/
http://openhome.cc/Gossip/JavaGossip-V1/AdvancedArrayConcept.htm
public class AdvancedArray {
public static void main(String[] args) {
int[] arr1 = {1, 2, 3, 4, 5};
int[] arr2 = {5, 6, 7};
int[] tmp;
tmp = arr1;
for(int i = 0; i < tmp.length; i++)
System.out.print(tmp[i] + " ");
System.out.println();
tmp = arr2;
for(int i = 0; i < tmp.length; i++)
System.out.print(tmp[i] + " ");
System.out.println();
}
}
|