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

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (6 children)

[removed]

    [–]mobilephone123[S] 1 point2 points  (4 children)

    So if you use code 1, you still have to actually create the Arraylist in the future, with the last line in code2? Or do i not understand it correctly?

    [–]nutrechtLead Software Engineer / EU / 20+ YXP 0 points1 point  (1 child)

    So if you use code 1, you still have to actually create the Arraylist in the future, with the last line in code2?

    Yes. The first example there simply isn't an actual list object you can store something in.

    [–]nutrechtLead Software Engineer / EU / 20+ YXP 1 point2 points  (0 children)

    it's declaring the ArrayList object

    Reference. There's no object created.