java二维数组如何添加数据

如题所述

第1个回答  2012-01-02
|| obj instanceof Long || obj instanceof BigDecimal
|| obj instanceof BigInteger || obj instanceof Byte) {
json.append("\"").append(string2json(obj.toString())).append("\"");
} else if (obj instanceof java.sql.Date || obj instanceof java.util.Date) {
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat(
"yyyy-MM-dd HH时mm分ss");//格式化日期
json.append("\"").append(sdf.format(obj)).append("\"");
} else if (obj instanceof Object[]) {
json.append(array2json((Object[]) obj));
} else if (obj instanceof List) {
json.append(list2json((List<?>) obj));
} else if (obj instanceof Map) {
json.append(map2json((Map<?, ?>) obj));
} else if (obj instanceof Set) {
json.append(set2json((Set<?>) obj));
} else if(obj instanceof File){
json.append("\"\"");
}else {本回答被提问者采纳
第2个回答  2011-12-20
所谓二维数组 就是数组里面放数组;
定义一个二维:直接定义: int[][] numeight={{100,200,300,400},{500,600,700,800},{900,1000,1100,1200,1300}};
访问方法:System.out.println(numeight[0][2]);
赋值定义: int[][] numfour=new int[2][2]; //定义一个int类型的数组同时为它分配2行2列的空间大小
赋值:numfour[0]={1,2};
int[] int1={2,3};
numfour[1]=int1;
//重新赋值:
numthree[1][0]=43;
System.out.printlnln(numthree[1][0]);
第3个回答  2011-12-20
//定义二维数组写法1
class numthree
{
public static void main(String[] args)
{
int[][] numthree; //定义一个float类型的2维数组
numthree=new int[5][5]; //为它分配5行5列的空间大小
numthree[0][0]=1;
numthree[1][0]=2;
numthree[2][0]=3;
numthree[3][0]=4;
numthree[4][0]=5
System.out.println(numthree[0][0]);
System.out.println(numthree[1][0]);
System.out.println(numthree[2][0]);
System.out.println(numthree[3][0]);
System.out.println(numthree[4][0]);
}
}
相似回答