Saturday 12 March 2016

PEMPROGRAMAN DASAR 4 (JAVA)


ECLIPSE - JAVA


public class Main {
public static void main(String[] args) {

// deklarasi dan instansiasi
int[] x = new int[100];

x[0] = 2;
x[1] = 7;
x[2] = 9;
// ...
x[99] = 12;

System.out.println(x[2]); // 9
// System.out.println(x[100]); error array index out of bound

int[] y = { 2, 3, 4, 5 };
System.out.println(y.length);
}
}

No comments:

Post a Comment