Posted on 2007-10-15 19:52
Glen 阅读(250)
评论(0) 编辑 收藏 所属分类:
Java语言
1.数组元素总是被赋予默认值,无论数组是在那里声明或者实例化(默认值:null,false,0,'\u0000')
2.数组声明的方式:
正确的方式
String []str = new String[5];
String str1[] = new String[5];
String str2[] = new String[]{"",""};
String str3[] = {"",""};
String []str4[] = new String[][]{{"",""},};
String []str4[] = new String[][]{{"",""},{"","",""}};
String []str4[] = {{"",""},{"","","",""}};
String []str4[] = new String[2][];
String []str4[] = new String[2][2];
错误的方式
String str4[] = new String[2]{"",""};
String []str4[] = new String[][2];
多维数组必须先确定前面的维数。
有不全的希望大家补充,谢谢!
做人简单一点好