Consider the following nested classes.
class Outerclass {
class innerclass {
}
}
class util {
//how to declare an array of innerclass objects here?
}
You can declare an array of innerclass
objects like this.
class util {
Outerclass.innerclass[] inner = new Outerclass.innerclass[10];
}
And to instantiate them you can do something like this inside the util
class.
void test() {
Outerclass outer = new Outerclass();
inner[0] = outer.new innerclass();
}