Arrays of Objects

Lets say I have a class foo defined like this: class foo {String a; String b; public foo(String a, String b) { this.a = a; this.b = b; } } Now I would like to make an array of class foo like this: foo myFoo[][]; How do I initialize this array and store foo objects in this it? I've tried everything I can think of but I keep getting a NullPointerException. Thanks, Frank

Surely Tony's code only builds and initializes a one-dimensional array, where the question calls for a two-dimensional array. It looks as if the step you are missing is to call new for each "row" of the array. Here's my suggestion:

I think someone could best help you figure this one out if you were to post an example of the code that you are trying to use? Don't forget to surround your code with the [ code ] and [ /code ] ubb tags. Good Luck.