# Cannot find a class or type name Circle

**URL:** <https://discourse.processing.org/t/cannot-find-a-class-or-type-name-circle/1951>\
**Category:** Coding Questions\
**Created:** [July 21, 2018, 2:31am UTC](https://discourse.processing.org/t/cannot-find-a-class-or-type-name-circle/1951 "2018-07-21T02:31:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sjames2](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sjames2](https://discourse.processing.org/u/sjames2)\
**Post date:** [July 21, 2018, 2:31am UTC](https://discourse.processing.org/t/cannot-find-a-class-or-type-name-circle/1951/1 "2018-07-21T02:31:20Z")

</div>

Hello! I’m recently new to java -processing, and we’re curently working on an animation assignment. I keep getting a class error message, that states "Cannot find a class or type named “Circle”.

If anyone could help me it would be greatly appreciated!

```auto
int dragon;
int dragonSkin = #d1afe8;
int horn = 255;
int AltDragonSkin =#99afe6;
int n_of_circles = 25;
Circle[] circles = new Circle[n_of_circles];

void setup() {
  size(500, 500);
  for (int i = 0; i < n_of_circles; i++) {
    circles[i] = new Circle(1, 9);
  }
}

void draw() {  
  dragon();
  background(#a7ecc3);
  
    {
  fill(dragonSkin);{
 beginShape();//body
  vertex(7, 500);
  bezierVertex(85, 425, 65, 370, 110, 360);//back
  bezierVertex(75, 280, 95, 280, 125, 245);//neck
  bezierVertex(195, 250, 145, 250, 137, 285);//other side
   bezierVertex(135, 305, 130, 300, 175, 370);//other side
  bezierVertex(230, 455, 135, 470, 170, 500);//chest
  endShape();
  
  beginShape();//body line
curveVertex(130,408);
curveVertex(130,408);
curveVertex(137,440);
curveVertex(125,460);
curveVertex(122,465);
curveVertex(120,470);
curveVertex(120,470);
endShape();

 beginShape();//wing
  vertex(90, 390);
   bezierVertex(80, 390, 50, 375, 50, 400);
  for (int i = 0; i < n_of_circles; i++) {
    circles[i].display();
    circles[i].move();
  }
}

class Circle {
  float posX = random(0, width); //for movement
  float posY = random(0, height); //cont.
  float speedX = 1000; //direction
  float speedY = 1000; //direction

 
  
  int diameter = 50;
  int radius = diameter/2;

  Circle(float min_speed, float max_speed) {
      
      speedX = random(min_speed, max_speed);
      speedY = random(min_speed, max_speed);
  }

  void display() {
     
      pushStyle();
      fill(#89CFF0);
       ellipse(posX, posY, diameter, diameter);    
      popStyle();
  }
  
  void move(){    
    posX += speedX;
    posY += speedY;
    bounce();

  }

  void bounce() {
      //for left or side edges
      if (posX - 15 < 0 || posX + radius > width) {
        speedX *= - 1; //inverts the sign
  
        if (posX - 15 < 0 ){ posX = radius; }
        if (posX + 15 > width ){ posX = width-radius; }
      }
      //for touching top or bottom edges
      if (posY - radius < 0 || posY + radius > height) {
        speedY *= -1; //inverts the sign

   
        if (posY - radius < 0 ){ posY = radius; }
        if (posY + radius > height ){ posY = height-radius; }
      }

  }
}
 
} 

```

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 21, 2018, 2:50am UTC](https://discourse.processing.org/t/cannot-find-a-class-or-type-name-circle/1951/2 "2018-07-21T02:50:50Z")

</div>

Your error is in the layout of the curly brackets. I suggest you look at the code in the PDE, press `ctrl+t` there and then follow each curly bracket starting from the top. Also, `class Circle` needs to be placed on the global scope. That is the main reason why you get the error.

Kf

---

<div class="post-metadata">

**Author:** ![sjames2](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sjames2](https://discourse.processing.org/u/sjames2)\
**Post date:** [August 1, 2018, 8:40pm UTC](https://discourse.processing.org/t/cannot-find-a-class-or-type-name-circle/1951/3 "2018-08-01T20:40:41Z")

</div>

I just realized I never thanked you. Thank you for helping me! I was able to figure it out.
