Array causing NullPointerException error?

NEVERMIND! I wasn’t actually creating the array using the constructor method.
Here’s the new code, (and also the solution to my problem):

Boolean[] keys = new Boolean[150];
void keyPressed() {
  keys[keyCode] = true;
  //print(keyCode);
 // print(key);
}
void keyReleased() {
  keys[keyCode] = false;
}
2 Likes