Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AtividadeMesCorrespondente {
- public static void main(String[] args) {
- var teclado = new Scanner(System.in);
- try{
- System.out.print("Digite o numero do mes: ");
- var numeroMes = Integer.parseInt(teclado.nextLine());
- System.out.println(String.format("O mes escolhido e: %s ",Mes.values()[numeroMes-1]));
- }catch(Exception e){
- System.out.println("Ocorreu um erro: "+e.getMessage());
- }finally{ teclado.close(); }
- }
- }
- enum Mes {
- JANEIRO,
- FEVEREIRO,
- MARCO,
- ABRIL,
- MAIO,
- JUNHO,
- JULHO,
- AGOSTO,
- SETEMBRO,
- OUTUBRO,
- NOVEMBRO,
- DEZEMBRO;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement