標題:
陣列
[打印本頁]
作者:
tonyh
時間:
2012-10-20 16:37
標題:
陣列
本帖最後由 tonyh 於 2012-10-20 16:51 編輯
6種不同的陣列宣告方式
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
t2364705
時間:
2012-10-20 16:58
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
t3742238
時間:
2012-10-20 17:01
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
劉漢文
時間:
2012-10-20 17:03
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
尤泓鈞
時間:
2012-10-20 17:05
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
粘靖瑜
時間:
2012-10-20 17:22
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
蔡昀佑
時間:
2012-10-20 17:26
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
黃博鴻
時間:
2012-11-3 14:12
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
String[] b={"春","夏","秋","冬"};
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
String c[]=new String[]{"春","夏","秋","冬"};
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
String e[];
e=new String[]{"春","夏","秋","冬"};
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2