- Listing
- Logika LaArray.java
The first step arrays can be declared indirectly.
Example: int [] x;
Only later in the initialization directly.
Example: x = new int [3];
After that, we declare each element of the variable x as well as fill in each element.
Example: x [0] = 20;
x [1] = 10;
x [2] = 30;
To get the output or output print give the print command,
Example: System.out.println ("The value of x [0]:" + x [0]);
System.out.println ("Nilaix [1]:" + x [1]);
System.out.println ("Nilaix [2]:" + x [2]);
- Output
Tidak ada komentar:
Posting Komentar