Lesson 14 of 34

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

9 min 25 XP

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

An array stores many values of the same type in order. Indexes start at 0, and arr.length gives the number of elements. An array's size can't change once it is created.

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-ல் எப்போதும் வரும்.

To fill an array from input: read the count n first, create new int[n], then read each value in a loop. Coding tests use this format all the time.

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.

arr[arr.length] throws ArrayIndexOutOfBoundsException. The last index is arr.length - 1.

Challenge

+25 XP

n மற்றும் n எண்களைப் படித்து, மிகப் பெரிய எண் மற்றும் மிகச் சிறிய எண்ணை print செய்யுங்கள். Input: 5 3 8 1 9 4 Output: Max: 9 Min: 1

Read n and then n numbers. Print the largest and smallest. 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.