Saturday, 31 August 2013

Making/Initializing Array of Struct Like Objects in Java

Making/Initializing Array of Struct Like Objects in Java

I am using Java SE on NetBeans 7.3.1.
I would like to form a Java array similar to the following in C
typedef struct sNewStruct{
int min;
int max;
} NewStruct;
NewTruct nsVar[19];
I tried the following
class IntRange{
int min, max;
}
IntRange[] rangeNodes = new IntRange[19];
My problem is that, while rangeNodes is successfully allocated, all of its
elements are nulls.

No comments:

Post a Comment