Advertisement
gastaojunior

EstruturaSelecaoSwitch

Mar 15th, 2012
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. package exemplosjava;
  2.  
  3. import javax.swing.JOptionPane;
  4.  
  5. public class EstruturaSelecaoSwitch {
  6.  
  7.     public static void main(String[] args) {
  8.         int codigo;
  9.         codigo = Integer.parseInt(JOptionPane.showInputDialog("Digite um código de 1 a 3"));
  10.         switch (codigo) {
  11.             case 1:
  12.                 JOptionPane.showMessageDialog(null, "Caderno");
  13.                 break;
  14.             case 2:
  15.                 JOptionPane.showMessageDialog(null, "Lapis");
  16.                 break;
  17.             case 3:
  18.                 JOptionPane.showMessageDialog(null, "Borracha");
  19.                 break;
  20.             default:
  21.                 JOptionPane.showMessageDialog(null, "Diversos");
  22.  
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement