| Author |
declaring an unitialized 2D array.
|
Hung Tang
Ranch Hand
Joined: Feb 14, 2002
Posts: 148
|
|
what is the proper syntax in declaring an unitialized 2D array. for example. The following is fine: Object [][] array = { {"test1", "test2", "test3"} }; } but when I type in the following code: public class Test { private Object [][] array; public Test() { array = { {"test1", "test2", "test3"} }; //error } } I get an error... why and how do I fix it?
|
 |
Hung Tang
Ranch Hand
Joined: Feb 14, 2002
Posts: 148
|
|
Sorry, I know what was the problem. The problem was that I didn't allocate memory for objects using new. So the fix: array = new Object[][] { {"test1", "test2", "test3"} };
|
 |
 |
|
|
subject: declaring an unitialized 2D array.
|
|
|