Need Help Understanding this code

Need help understanding how these lines of codes work. I know they are variables and methods, but beyond that I’m confused.

//
int x=50;
Circles[]circle=new Circles [x];
//
void setup(){
  size(800,600);
  frameRate(120);
  //
  for(int i=0;i<circle.length;i++){
    circle[i]=new Circles();
  }
}
//
void draw(){
  for(int i=0;i<circle.length;i++){
    circle[i].move();
    circle[i].display();
  }
}
//
class Circles{
  float x;
  float y;
  float xspeed;
  float yspeed;
  float circlesize;
//
Circles(){
    x=random(100,700);
    y=random(100,700);
    xspeed=random(0.5,1);
    yspeed=random(0.5,1);
    circlesize=random(40,100);
  }
//
void move(){
    x =x+xspeed;
    y =y+yspeed;
    if(x+(circlesize/3)>800||x-(circlesize/3)< 0){
      xspeed=xspeed*-1;
    }
    if(y+(circlesize/3)>600||y-(circlesize/3)< 0) {
      yspeed=yspeed*-1;
    }
  }
// 
void display() {
  fill(254,127,156);
  ellipse(x,y,circlesize,circlesize);
  }}

The bottom part below draw is a class named circle. This is a generic description of a circle that can be replicated.

The following code is called whenever a copy of the circle class is created.

Circles(){
    x=random(100,700);
    y=random(100,700);
    xspeed=random(0.5,1);
    yspeed=random(0.5,1);
    circlesize=random(40,100);
  }

It sets x, y, xspeed, yspeed and circlesize to random values.

The following code moves the circle.

void move(){
    x =x+xspeed;
    y =y+yspeed;
    if(x+(circlesize/3)>800||x-(circlesize/3)< 0){
      xspeed=xspeed*-1;
    }
    if(y+(circlesize/3)>600||y-(circlesize/3)< 0) {
      yspeed=yspeed*-1;
    }
  }

It adds xspeed to the Circles x, and yspeed to the Circles y, as long as the circle is within certain coordinates.


The following code draws the circle.

void display() {
  fill(254,127,156);
  ellipse(x,y,circlesize,circlesize);
  }

This code at the top creates a list of Circles.

Circles[]circle=new Circles [x];

This list is called an array.

This code in setup puts a circle in every spot in the array.

  for(int i=0;i<circle.length;i++){
    circle[i]=new Circles();
  }

This is a loop that repeats until it has acted once for every spot in the array.

The following code in draw moves and displays every circle.

for(int i=0;i<circle.length;i++){
    circle[i].move();
    circle[i].display();
  }

It cycles through every circle in the list calling the move and display methods that were defined in the circle class.