Skip to content

Instantly share code, notes, and snippets.

@marclerodrigues
Created September 22, 2021 22:03
Show Gist options
  • Select an option

  • Save marclerodrigues/2ff1cd0d165052567244a1638d977293 to your computer and use it in GitHub Desktop.

Select an option

Save marclerodrigues/2ff1cd0d165052567244a1638d977293 to your computer and use it in GitHub Desktop.
Questão em Java para Treinar Switch Case
import java.util.Scanner;
class MyClass {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int dia = scanner.nextInt();
switch(dia) {
case 1: {
System.out.println("Domingo");
break;
}
case 2: {
System.out.println("Segunda");
break;
}
case 3: {
System.out.println("Terca");
break;
}
case 4: {
System.out.println("Quarta");
break;
}
case 5: {
System.out.println("Quinta");
break;
}
case 6: {
System.out.println("Sexta");
break;
}
case 6: {
System.out.println("Sábado");
break;
}
default: {
System.out.println("Não existe");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment