這次上課提早半小時出門,到達教室有充裕的時間可以醞釀一下上課的情緒(上課要醞釀什麼情緒阿 = =+)。總之,沉澱的心情較適合學習。
今日所學:陣列、物件
JAVA正規宣告陣列的方式與C語言完全不同,但後來也有加入一些宣告語法是仿C語言的。
※一維陣列的宣告:
int[] k=new int[5];
int k[]=new int[5];
int[] k=new int[]{10,20,30,40,50};
int k[]=new int[]{10,20,30,40,50};
仿C
int[] k={10,20,30,40,50};
int k[]={10,20,30,40,50};
※二維陣列的宣告:
int[][] k=new int[3][5];
int[] k[]=new int[3][5];
int k[][]=new int[3][5];
int[][] k=new int[][]{{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};
int[] k[]=new int[][]{{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};
int k[][]=new int[][]{{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};
仿C
int[][] k={{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};
int[] k[]={{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};
int k[][]={{10,20,30,40,50},{60,70,80,90,100},{110,120,130,140,150}};