Mengisi Nilai Array Secara Manual

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package arraymanual;

/**
*
* @author Angga
*/
public class arrayManual {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int[] anArray;
anArray = new int[10];

anArray[0]= 100;
anArray[1]= 200;
anArray[2]= 300;
anArray[3]= 400;
anArray[4]= 500;
anArray[5]= 600;
anArray[6]= 700;
anArray[7]= 800;
anArray[8]= 900;
anArray[9]= 1000;

System.out.println(“Element at Index 0: “+anArray[0]);
System.out.println(“Element at Index 1: “+anArray[1]);
System.out.println(“Element at Index 2: “+anArray[2]);
System.out.println(“Element at Index 3: “+anArray[3]);
System.out.println(“Element at Index 4: “+anArray[4]);
System.out.println(“Element at Index 5: “+anArray[5]);
System.out.println(“Element at Index 6: “+anArray[6]);
System.out.println(“Element at Index 7: “+anArray[7]);
System.out.println(“Element at Index 8: “+anArray[8]);
System.out.println(“Element at Index 9: “+anArray[9]);

}

}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google

You are commenting using your Google account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

Connecting to %s