Reputation: 4115
Excuse me because I am a beginner in Java ...
I want to translate the following code that I have done in C to Java:
#define ROWIMAGES 5
#define COLUMNIMAGES 11
typedef struct {
int posX;
int posY;
int active;
} image;
image images[COLUMNIMAGES][ROWIMAGES];
I'm trying to translate it as follows:
private static final int ROWIMAGES = 5;
private static final int COLUMNIMAGES = 11;
class image{
int posX;
int posY;
int active;
}
image images[COLUMNIMAGES][ROWIMAGES];
The array in Java throws a syntax error, what's wrong?
Thanks in advance.
Upvotes: 0
Views: 272
Reputation:
image[][] images = new image[COLUMNIMAGES][ROWIMAGES]
. In Java you have to call new on an array.Additional hints:
Upvotes: 1