2012-08-01 72 views
-1
String[][] str=null; 
str = new String[3]; 

* I有一個陣列的字符串作爲如何分配二維字符串數組?

String[][] str=null; 

如果我分配的str=new String[3]值它顯示error.how做*

+0

'海峽=新的String [3] [];' – Thor84no 2012-08-01 11:01:57

回答

1
String[][] str=null; 
str=new String[3][3]; 
+0

感謝ü非常 – shivcena 2012-08-01 11:19:47

1

String[][] str=null;是矩陣不是矢量。您必須將其作爲一個啓動。 String[rows][columns]

0
String[][] str=null; 
    str=new String[3][]; 

默認情況下,將設定值作爲null

0

字符串[] [] STR = NULL; str = new String [3];

您聲明二維陣列,但初始化像一名維

代碼應該是 字符串[] [] STR = NULL; str = new String [1] [1];

OR

String[][] str=null; 
    str=new String[2][1] 
+0

S,你是對的 – shivcena 2012-08-01 12:13:50