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.