Lesson 14 of 34

Arrays: பல மதிப்புகளை ஒன்றாக

9 min 25 XP

Array ஒரே type-ன் பல மதிப்புகளை வரிசையாகச் சேமிக்கும். Index 0-லிருந்து தொடங்கும். arr.length உறுப்புகளின் எண்ணிக்கையைத் தரும். Array உருவான பின் அதன் அளவை மாற்ற முடியாது.

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-ல் ஒவ்வொன்றாகப் படியுங்கள். இந்த முறை coding tests-ல் எப்போதும் வரும்.

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.