Array

BY : ABIYYU CAKRA / XI RPL 1

1. ARRAY SINGLE-DIMENSION

public class Array1D {
    public static void main(String[] args) {
        String []nama={"ABIYYU","CAKRA"};
        for (int i=0;i<nama.length;i++) {
            System.out.println(nama[i]);
        }
        System.out.println();
  }
}

OUTPUT :

ABIYYU
CAKRA

2. ARRAY MULTI-DIMENSION

public class Array {
    public static void main(String[] args) {
        int [][]nomer= new int [0][0];
        for(int i=0;i<3;i++) {
            for(int j=0;j<3;j++){
                System.out.println(+i+"|"+j);
            }
        } 
    }
}

OUTPUT :

0|0
0|1
0|2
1|0
1|1
1|2
2|0
2|1
2|2

Komentar