Access to a class variable

Hello, I want to acess to a class variable but I can´t. How do I do it?
</if (dist(xpos,ypos,balls.xpost,balls.ypost)<=0){

}

Class name is Ball

This looks pretty good, maybe a typo

ball.xpos?

Show your entire code, when balls is an array it looks different