Rectangle Collision in ArrayList

Thank you for your answers! Now, I’m trying to figure out the code in the boolean compare(Box A) method. Am I right if I’m assuming, that I have to put that method in my “Cars” class? Then, for example “x” would be referring to “this.posX” (in my case), right? But what should I type for y.height? I’m very confused, right now.

Also, with “Boxes” you are referring to the Cars-Class and my carArray-List (for boxes-Arraylist), am I right?