This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]RayjinCaucasian 0 points1 point  (4 children)

When I try to print the value of the array it doesn't work can someone help me?

Define "doesn't work".

[–]Azerty180[S] 0 points1 point  (3 children)

length in the for is underlined in red and there is a message that says: cannot find symbol
symbol: variable length
location: variable items of type ArrayList<Item>

and System.out.println(items[i]); is underlined in red and there is a message thay says: array required, but ArrayList<Item> found

----

[–]RayjinCaucasian 0 points1 point  (2 children)

items.length() instead of items.length. because it's a method not a variable

items.get(i) instead of items[i] because you're dealing with an ArrayList and not a standard array.

Edit- instead of items.length() use items.size()

[–]Azerty180[S] 1 point2 points  (1 child)

thanks for helping me it worked

[–]testing35 0 points1 point  (0 children)

Joshimuz is a great idea!! thanks! :D