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.