Want to make an array but it doesn't work

I want to make an array list for my obstacles.

This is my full code:

StripeMovement[] stripes = new StripeMovement[10];

ObstacleMovement obstacle1 = new ObstacleMovement(100, 200, 10, 6);

ObstacleMovement obstacle2 = new ObstacleMovement(350, 200, 10, 7);

ObstacleMovement obstacle3 = new ObstacleMovement(600, 200, 10, 8 );

ObstacleMovement obstacle4 = new ObstacleMovement(475, 200, 15, 4 );

ObstacleMovement obstacle5 = new ObstacleMovement(225, 200, 15, 5 );

Car carmain = new Car();

Timer startTimer;

int x = 0;

int y = 450;

void keyPressed() { // This is the restarter // Sometimes I have to spam the “r” key to restart my game not sure why

if ( key == ‘r’ ) {

loop();
draw();
startTimer = new Timer(0);

}
}

void setup() {

size (720, 600);
startTimer = new Timer(0);

for ( int i = 0; i < stripes.length; i++ ) {
stripes[i] = new StripeMovement(100, 30, 60, 10);
}
}

void draw () {

background (#484646);

smooth();

strokeWeight(3);

if (mousePressed == true) {

background(0);

fill(255);
quad(2, 10, 170, 10, 170, 60, 40, 60);

fill(random(255), random(255), random(250));
text(startTimer.getTime(), 20, 50);

} else {

background(#484646);

}

line(240, 0, 240, 600);

line(480, 0, 480, 600);

for ( int i = 0; i < stripes.length; i++ ) {
stripes[i].run();
}

startTimer.countUp();

obstacle1.run();

obstacle2.run();

obstacle3.run();

obstacle4.run();

obstacle5.run();

carmain.run();

fill(0);
textSize(40);
text(startTimer.getTime(), 20, 50);

if (dist(obstacle1.x, obstacle1.y, mouseX, y) < 50) {

background (0);

noLoop();

textSize(80);

fill(#3279D8);

text("Your Time!", 160, height/2);
text("Press r to restart", 50, 500);

fill(255);
text (startTimer.getTime(), 225, 200);
startTimer.countDown();
startTimer.countUp ();

}

if (dist(obstacle2.x, obstacle2.y, mouseX, y) < 50) {

background (0);

noLoop();

textSize(80);

fill(#3279D8);

text("Your Time!", 160, height/2);
text("Press r to restart", 50, 500);

fill(255);
text (startTimer.getTime(), 225, 200);
startTimer.countDown();
startTimer.countUp ();

}

if (dist(obstacle3.x, obstacle3.y, mouseX, y) < 50) {

background (0);

noLoop();

textSize(80);

fill(#3279D8);

text("Your Time!", 160, height/2);
text("Press r to restart", 50, 500);

fill(255);
text (startTimer.getTime(), 225, 200);
startTimer.countDown();
startTimer.countUp ();

}

if (dist(obstacle4.x, obstacle4.y, mouseX, y) < 50) {

background (0);

noLoop();

textSize(80);

fill(#3279D8);

text("Your Time!", 160, height/2);
text("Press r to restart", 50, 500);

fill(255);
text (startTimer.getTime(), 225, 200);
startTimer.countDown();
startTimer.countUp ();

}

if (dist(obstacle5.x, obstacle5.y, mouseX, y) < 50) {

background (0);

noLoop();

textSize(80);

fill(#3279D8);

text("Your Time!", 160, height/2);
text("Press r to restart", 50, 500);

fill(255);
text (startTimer.getTime(), 225, 200);
startTimer.countDown();
startTimer.countUp ();

}
}

And this is my Movement class:

class ObstacleMovement {

int x;

int y;

int size;

color col1 = color ( random(255), random(255), 255);

float type=random(1);

int speed;

ObstacleMovement( int newX, int newY, int newSize, int newSpeed ) {

x = newX;

y = newY;

size = newSize;

speed = newSpeed;

}

void move() {

y = y + speed;

if (y > height) {

  y = -20;

}

}

void display() {

if (type>0.5) {

  fill (col1);

  rect(x, y, 

    70, 80); // obstacle rectangle

} else {

  fill(255, 255, 0);

  ellipse(x, y, 75, 75); // Obstacle circle
  
  

}

}

void run() {

move();

display();

}

}

So if anyone know how to make an array for my obstacles where they are still able to fall down at a different speed it would be very helpful




//StripeMovement[] stripes = new StripeMovement[10];
ObstacleMovement[] obstacles = new ObstacleMovement[5];   
//Car carmain = new Car();
//Timer startTimer;

//int x = 0;
//int y = 450;

// -------------------------------------------------------------------

void setup() {
  size (1720, 600);
  //startTimer = new Timer(0);
  //for ( int i = 0; i < stripes.length; i++ ) {
  //  stripes[i] = new StripeMovement(100, 30, 60, 10);
  //}
  //  frameRate(11);

  obstacles[0]  =  new ObstacleMovement(100, 200, 10, 6);
  obstacles[1]   = new ObstacleMovement(350, 200, 10, 7);
  obstacles[2]  = new ObstacleMovement(600, 200, 10, 8 );
  obstacles[3]  = new ObstacleMovement(475, 200, 15, 4 );
  obstacles[4]  = new ObstacleMovement(225, 200, 15, 5 );
}

void draw () {
  background (#484646);

  strokeWeight(3);

  for (ObstacleMovement currentObstacle : obstacles) {
    currentObstacle.run();
  }

  line(240, 0, 240, 600);
  line(480, 0, 480, 600);
}

// =======================================================================================
// And this is my Movement class:

class ObstacleMovement {

  int x;
  int y;
  int size;
  color col1 = color ( random(255), random(255), 255);
  float type=random(1);
  int speed;

  ObstacleMovement( int newX, int newY, 
    int newSize, 
    int newSpeed ) {
    x = newX;
    y = newY;
    size = newSize;
    speed = newSpeed;
  }

  void move() {
    y = y + speed;
    if (y > height) {
      y = -20;
    }
  }

  void display() {
    if (type>0.5) {
      fill (col1);
      fill(255, 3, 0);
      rect(x, y, 
        70, 80); // obstacle rectangle
    } else {
      fill(255, 255, 0);
      ellipse(x, y, 75, 75); // Obstacle circle
    }
  }

  void run() {
    move();
    display();
  }
}//class
//