求助 关于字符串的二维数组
我知道字符串本身就是一个字符数组但是有没有可能实现一个二维数组 里的元素是字符串?
不是转化成二维数组 而是将字符串存入2维数组
求助!
程序代码:import import import import import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class testExcelReader {
public static void main(String[] args) throws BiffException, IOException {
String excelFile="E:\\abc.xls";
Workbook rwb = null;
String[][] str =new String[][]{{}};
// 创建输入流
InputStream stream = new FileInputStream(excelFile);
// 获取Excel文件对象
rwb = Workbook.getWorkbook(stream);
// 获取文件的指定工作表 默认的第一个
Sheet sheet = rwb.getSheet(0);
//获取第一行,第一列的值
for(int i=0;i<10;i++){
String[] s=new String[]{};
for(int j=0;j<10;j++){
Cell c00 = sheet.getCell(i, j);
String strc00 = c00.getContents();
s[j]=strc00; //这是第28行
}
str[i]=s;
}
for(int i=0;i<10;i++)
for(int j=0;j<10;j++){
System.out.println(str[i][j]);
}
}
}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0