我這打印數(shù)組為什么不對???幫我看下 謝謝了
public?class?HelloWorld?{ ????public?static?void?main(String[]?args)?{ ???????? ??//?定義一個長度為5的字符串?dāng)?shù)組,保存考試科目信息 ??String[]?subjects?=new?int[5]????????????????????; ???????? ??//?分別為數(shù)組中的元素賦值 ??subjects[0]?=?"Oracle"; ??subjects[1]?=?"PHP"; ??subjects[2]?=?"Linux"; ??subjects[3]?=?"Java"; ??subjects[4]?=?"HTML"; ???????? ??System.out.println("數(shù)組中第4個科目為:"?+?????subjects[3]??????); ?} }
2016-01-20
String[]?subjects?=new?int[5] ;這個地方錯了。應(yīng)該改成String[] subjects=new String[5]。前面是什么數(shù)據(jù)類型后面就是什么數(shù)據(jù)類型
2016-01-20
醉了,人家的是字符串?
2015-12-23
Srring[] subjects=new String[5];
2015-12-23
String[] subjects = new String[5];
2015-12-23
改成這樣:
?String[] subjects =new String[5] ?;
2015-12-23
String[] subjects = new string [5];數(shù)組類型!!!!你到底是要String類型還是int類型啊????