標題:
陣列 (一)
[打印本頁]
作者:
tonyh
時間:
2014-11-29 16:10
標題:
陣列 (一)
本帖最後由 tonyh 於 2014-11-29 17:03 編輯
試用6種不同的陣列宣告方式, 宣告包括春夏秋冬四個成員的陣列.
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String[] b={"春","夏","秋","冬"};
String c[]=new String[]{"春","夏","秋","冬"};
String[] d=new String[]{"春","夏","秋","冬"};
String e[];
e=new String[]{"春","夏","秋","冬"};
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
林宇翔
時間:
2014-11-29 17:01
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String []b={"春","夏","秋","冬"};
String c[]=new String[]{"春","夏","秋","冬"};
String []d=new String[]{"春","夏","秋","冬"};
String e[];
e=new String[]{"春","夏","秋","冬"};
String []f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
System.out.println("陣列a: "+c[0]+c[1]+c[2]+c[3]);
System.out.println("陣列a: "+d[0]+d[1]+d[2]+d[3]);
System.out.println("陣列a: "+e[0]+e[1]+e[2]+e[3]);
System.out.println("陣列a: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
周雍程
時間:
2014-11-29 17:02
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String []b={"春","夏","秋","冬"};
String c[]=new String[]{"春","夏","秋","冬"};
String []d=new String[]{"春","夏","秋","冬"};
String e[];
e=new String[]{"春","夏","秋","冬"};
String f[];
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[2]);
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[2]);
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[2]);
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[2]);
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[2]);
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[2]);
}
}
複製代碼
作者:
李允軒
時間:
2014-11-29 17:04
public class ch01
public static void(String args[])
{
String a[]=["春","夏","秋","冬"];
String []b=["春","夏","秋","冬"];
String c[]=new String["春","夏","秋","冬"];
String []d=new String["春","夏","秋","冬"];
String e;
e=new String["春","夏","秋","冬"];
String f;
f=new String["春","夏","秋","冬"];
System.out.println["陣列a"+a[0]+a[1]+a[2]+a[3]];
System.out.println["陣列b"+b[0]+b[1]+b[2]+b[3]];
System.out.println["陣列c"+c[0]+c[1]+c[2]+c[3]];
System.out.println["陣列d"+d[0]+d[1]+d[2]+d[3]];
System.out.println["陣列e"+e[0]+e[1]+e[2]+e[3]];
System.out.println["陣列f"+f[0]+f[1]+f[2]+f[3]];
}
複製代碼
作者:
張郁庭
時間:
2014-11-29 17:05
import java.io.Console;
public class ch34
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String[] b={"春","夏","秋","冬"};
String c[]=new String []{"春","夏","秋","冬"};
String[] c=new String []{"春","夏","秋","冬"};
String [];
e=new String[]{"春","夏","秋","冬"};
String [] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列a:"+a[0]+a[1]+a[2]+a[3]);
System.out.println("陣列b:"+b[0]+b[1]+b[2]+b[3]);
System.out.println("陣列a:"+c[0]+c[1]+c[2]+c[3]);
System.out.println("陣列a:"+d[0]+d[1]+d[2]+d[3]);
System.out.println("陣列a:"+e[0]+e[1]+e[2]+e[3]);
System.out.println("陣列a:"+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
張彥承
時間:
2014-11-29 17:07
public class ch33
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String []b={"春","夏","秋","冬"};
String c[]={"春","夏","秋","冬"};
String []d={"春","夏","秋","冬"};
String e[];
String new String[]={"春","夏","秋","冬"};
String []f;
f=new String[]{"春","夏","秋","冬"};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
System.out.println{"陣列a:"+a[0]+a[1]+a[2]+a[3]};
}
}
複製代碼
作者:
劉得恩
時間:
2014-11-29 17:08
public class ch35
{
public static void main(String[] brgs)
{
String a[]={"春","夏","秋","冬"};
String[] b={"春","夏","秋","冬"};
String c[]=new String[]{"春","夏","秋","冬"};
String[] d=new String[]{"春","夏","秋","冬"};
String e[];
String[] f;
e=new String[]{"春","夏","秋","冬"};
f=new String[]{"春","夏","秋","冬"};
System.out.println("a:"+a[0]+a[1]+a[2]+a[3]);
System.out.println("b:"+b[0]+b[1]+b[2]+b[3]);
System.out.println("c:"+c[0]+c[1]+c[2]+c[3]);
System.out.println("d:"+d[0]+d[1]+d[2]+d[3]);
System.out.println("e:"+e[0]+e[1]+e[2]+e[3]);
System.out.println("f:"+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
作者:
張峻瑋
時間:
2014-12-3 19:50
public class ch35
{
public static void main(String args[])
{
String a[]={"春","夏","秋","冬"};
String[] b={"春","夏","秋","冬"};
String c[]=new String[]{"春","夏","秋","冬"};
String[] d=new String[]{"春","夏","秋","冬"};
String e[];
e=new String[]{"春","夏","秋","冬"};
String[] f;
f=new String[]{"春","夏","秋","冬"};
System.out.println("陣列a: "+a[0]+a[1]+a[2]+a[3]);
System.out.println("陣列b: "+b[0]+b[1]+b[2]+b[3]);
System.out.println("陣列c: "+c[0]+c[1]+c[2]+c[3]);
System.out.println("陣列d: "+d[0]+d[1]+d[2]+d[3]);
System.out.println("陣列e: "+e[0]+e[1]+e[2]+e[3]);
System.out.println("陣列f: "+f[0]+f[1]+f[2]+f[3]);
}
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2