Lesson 14 of 34

Arrays: ಹಲವು values ಒಟ್ಟಿಗೆ

9 min 25 XP

Array ಒಂದೇ type ನ ಹಲವು values ಅನ್ನು ಕ್ರಮವಾಗಿ ಸಂಗ್ರಹಿಸುತ್ತದೆ. Indexes 0 ಯಿಂದ ಆರಂಭ, arr.length ಅಂಶಗಳ ಸಂಖ್ಯೆಯನ್ನು ಕೊಡುತ್ತದೆ. ರಚಿಸಿದ ನಂತರ array ಯ size ಬದಲಾಗದು.

Example: edit me and press Run

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

Input ನಿಂದ array ತುಂಬಲು: ಮೊದಲು ಎಣಿಕೆ n ಓದಿ, new int[n] ರಚಿಸಿ, ನಂತರ loop ನಲ್ಲಿ ಪ್ರತಿ value ಓದಿ. Coding tests ನಲ್ಲಿ ಯಾವಾಗಲೂ ಇದೇ format.

Example: edit me and press Run

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

arr[arr.length] ArrayIndexOutOfBoundsException ಕೊಡುತ್ತದೆ. ಕೊನೆಯ index arr.length - 1.

Challenge

+25 XP

n ಮತ್ತು ನಂತರ n ಸಂಖ್ಯೆಗಳನ್ನು ಓದಿ. ಅತಿ ದೊಡ್ಡ ಮತ್ತು ಅತಿ ಚಿಕ್ಕದನ್ನು print ಮಾಡಿ. Input: 5 3 8 1 9 4 Output: Max: 9 Min: 1

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