I need to add the Rectangle to the ArrayList called bricks as you can see below.
private void drawBrick(int startX, int startY){ new Rectangle(); currentColor = 0; startX = 54; startY = 16; bricks = new ArrayList<Rectangle>(); bricks.add("Rectangle"); } I keep getting compilation errors after adding that that last line of code and this weird warning pops up saying "Some messages have been simplified; recompile with -Xdiags:verbose to get full output."
Anyone know what I've done wrong?
new Rectangle(), you made aRectangleobject. Right now you're not actually doing anything with it though, you would store that in a variable then add it to your list.Rectangleinto the list, not a Rectangle object. You should assign yournew Rectangle()to a variable and use that.ArrayListbrickseach time you call the method, making it useless.add()methods in Java.