Hi there i'm creating a small game for school, but when i try to do this to fill out the x and y variables in this array i get a NPE. Could anyone help?
public class mainclass {
public static void main(String[] args) {
Gra piece[] = new Gra[10];
for (int i = 0; i < piece.length; i++) {
piece[i].x = 50;
piece[i].y = 50;
}
}
}
class Gra{
public int x = 50;
public int y = 10;
}