Last active
February 12, 2019 07:04
-
-
Save edwardyi/88d2772df5b85e208f42473e75d09a50 to your computer and use it in GitHub Desktop.
Revisions
-
edwardyi revised this gist
Feb 12, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public class Test{ System.out.println(arr[i]); } } public static void main(String[] args){ // 沒有指定型別的話會出現小黃線 ArrayList<Integer> arr = new ArrayList<Integer>(); arr.add(1); -
edwardyi created this gist
Feb 12, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ // 沒有加會有小紅線提示 import java.util.ArrayList; public class Test{ public static void test1{ int[] arr = new int[10]; arr[0] = 2; arr[1] = 3; for(int i=0; i< arr.length; i++){ System.out.println(arr[i]); } } public function main(String args[]){ // 沒有指定型別的話會出現小黃線 ArrayList<Integer> arr = new ArrayList<Integer>(); arr.add(1); arr.add(3); arr.add(5); arr.remove(1); //移除第二個元素 for(int i=0; i<arr.size(); i++){ // 使用get來取得陣列的值 System.out.println(arr.get(i)); } } }