標題:
陣列 (一)
[打印本頁]
作者:
tonyh
時間:
2014-6-28 14:24
標題:
陣列 (一)
本帖最後由 tonyh 於 2014-6-28 14:34 編輯
試用6種不同的陣列宣告方式, 宣告包括春夏秋冬四個成員的陣列.
public class ch33
{
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]);
}
}
複製代碼
作者:
劉泳鱔
時間:
2014-6-28 14:44
public class ch33
{
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]);
}
}
複製代碼
作者:
鎧言
時間:
2014-6-28 14:46
public class ch33
{
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]);
}
}
複製代碼
作者:
張瀚仁
時間:
2014-6-28 14:48
import java.io.Console;
public class ch35
{
public static void main(String args [])
{
String a[]={"春","夏","秋","冬"};
System.out.println{a[0]+a[1]+a[2]+a[3]};
String[] b={"春","夏","秋","冬"};
System.out.println{b[0]+b[1]+b[2]+b[3]};
String c[]=new String{"春","夏","秋","冬"};
System.out.println{c[0]+c[1]+c[2]+c[3]};
String[] d=new String[]{"春","夏","秋","冬"};
System.out.println{d[0]+d[1]+d[2]+d[3]};
String e[];
e=new String{"春","夏","秋","冬"};
System.out.println{e[0]+e[1]+e[2]+e[3]};
String[] f;
f=new String{"春","夏","秋","冬"};
System.out.println{f[0]+f[1]+f[2]+f[3]};
}
}
複製代碼
作者:
林以諾
時間:
2014-7-4 20:04
public class ch33
{
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]);
}
}
複製代碼
作者:
黃崇維
時間:
2014-7-4 20:06
public class ch33
{
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]);
}
}
複製代碼
作者:
許逸群
時間:
2014-8-26 15:33
public class ch33
{
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