Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫  π  -¹ ² ³ °

You are not logged in.

## #1 2017-01-28 11:35:47

Hannibal lecter
Member
Registered: 2016-02-11
Posts: 225
Website

### I need to learn java language "Arrays",..

Hi I need to learn java language "Arrays"
from zero, cause I don't know how to use arrays I'mm fully not understaing this topic in java

Wisdom is a tree which grows in the heart and fruits on the tongue

Offline

## #2 2017-07-29 02:39:50

Jabuto
Member
Registered: 2017-07-29
Posts: 11

### Re: I need to learn java language "Arrays",..

they are quite simple actually, in my opinion at least.

``````  int x = 1;  // regular integer

int[] y;     // an integer array! it is still just an empty name...

y = new int[5];   // we put a fresh array length of length 5 to it. think of box with exactly 5 slots for ints.

y[0] = 11;    // we can access the 5 slots with "index". indexes start from zero. (so 0,1,2,3 and 4 are valid).

y = new int[99]; // we erase the current array and create new one, as size cannot change in-between.

for(int i=0; i<y.length; i++){  y[i] = i+1; }   // we put numbers 1-99 to the array.

try{  y[100] = 0; } // watch here, we access 101th slot in the array, which does not exist.
catch(IndexOutOfBoundsException){}   // an error will be raised. be careful with this.

string[] z; // string array is as fine as any other...

myObject[] mo;   // any obeject can form an array!

bool[,] b = new bool[10,10] // a fancy, two-dimensional array! it works like other arrays, but you must give two indexes to access "a slot".

bool[,,,] bbb = new bool[2,4,6,8]; // while this is legit, it may use lots of space.

int[][] ii = new int[5][]; // an array of array of ints! box, which contains boxes, which contain ints.

ii[0] = new int[4]   // a new box to a box.

ii[0][0] // a number to box inside box.``````

arrays have also many useful built-in methods which you can search from the manual.

You will die knowing being right. My only cost is your fullfilment.
--- The Devil

Offline

## #3 2019-02-11 21:50:39

kame10
Member
Registered: 2019-02-11
Posts: 1

### Re: I need to learn java language "Arrays",..

Why don't you take the help any online tutorial for programming?

Offline