/*========================================================================
nama file : input data
tanggal : 12 des 2011
programmer: Hendra Silaban
deskripsi : -menginput data
-array 1 dimensi
========================================================================*/
import javax.swing.JOptionPane;
class Array1Dimensi
{
public static void main(String[] args)
{
String nilais[]= new String[5];
int nilai[] = new int [5];
int ulang = 4;
int i = 0;
do{
nilais[i] = JOptionPane.showInputDialog("masukkan nilai ke " + (i+1));
nilai[i] = Integer.parseInt(nilais[i]);
i++;
}while(i < ulang);
i = 0;
do{
System.out.println("nilai ke " + i +" = "+ nilai[i]);
i++;
}while(i < ulang );
}
}
jika dijalankan maka akan tampil....
Tidak ada komentar:
Posting Komentar