/*========================================================================
programmer: Hendra Silaban
nama file : input data
tanggal : 28 nov 2011
deskripsi : -menginput data
-penggunaan switch case
========================================================================*/
import javax.swing.JOptionPane;
class SwitchCase
{
public static void main(String[] args)
{
String nilai1s;
int nilai1;
nilai1s = JOptionPane.showInputDialog("masukan pilihan : ");
nilai1 = Integer.parseInt(nilai1s);
switch (nilai1)
{
case 1:JOptionPane.showMessageDialog(null,"satu");
break;
case 2:JOptionPane.showMessageDialog(null,"dua");
break;
case 3:JOptionPane.showMessageDialog(null,"tiga");
break;
default:JOptionPane.showMessageDialog(null,"tidak ada");
break;
}
}
}
Tidak ada komentar:
Posting Komentar