Lesson 16 of 34

ArrayList: वाढणारी List

9 min 30 XP

Array चा size ठरलेला असतो. किती items येतील हे माहीत नसेल तर ArrayList वापरा, ती आपोआप वाढते. < > मध्ये int ऐवजी Integer आणि double ऐवजी Double लिहा.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Array: arr.length (brackets नाहीत). String: s.length(). ArrayList: list.size(). Interview मध्ये या तिघांची गल्लत करू नका!

Challenge

+30 XP

n आणि n संख्या वाचा. फक्त सम संख्या ArrayList मध्ये ठेवा आणि ती print करा. Input: 6 1 4 7 10 12 3 Output: [4, 10, 12]

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.