All pastes #964462 Raw Edit

Switch Case.

public java v1 · immutable
#964462 ·published 2008-03-31 08:05 UTC
rendered paste body
/* * To change this template, choose Tools | Templates * and open the template in the editor. */package aula1;/** * * @author soro */public class SwitchCase {    public static void main(String[] arg) {        int opc = 1;              //Iniciando switch para verificar OPC. Como opc foi declarado igual a 1, então ele sempre será...       //Porém você pode usar o BufferedReader para entrar dados e setar opc para um número qualquer que o usuário entre.        switch (opc) {            //Aqui ele apenas vai fazer o check do opc, se ele for igual ah uma das opções, ele vai mostrar a mensagem.            case (1):                   System.out.println("Aprendir switch :D");                   break;            case (2):                   System.out.println("Switch é muito legal");                  break;        }        //Finaliza o programa.        System.exit(0);    }}