I have this class constructor:
公共类别(intmax ) {
.
}
The thing is,I want to make an array of this class,how do I initialize it?
privatecategorycategories=new category (max ) [4];
订单不工作。
更新
Do I need to do something like this?
private category [ ] categories=new category [4];
And then initialize each object?
When you are making an array,youarecreatinganarrayofcategory.thatsaninstanceofarry。
whenyouarepopulatingthearraywithcategoryobjects,atthatpointyousethecategorywithconst。
category [ ] categories=new category [4];
categories[0]=newcategory(10 );