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.