Advertisement
galinyotsev123

ProgBasicsJavaBook4.1ComplexConditions10AnimalType

Jan 19th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class E10AnimalType {
  4. public static void main(String[] args) {
  5. Scanner scanner = new Scanner(System.in);
  6.  
  7. String animal = scanner.nextLine();
  8.  
  9.  
  10. switch (animal){
  11. case "dog":
  12. System.out.println("mammal");
  13. break;
  14. }
  15. switch (animal){
  16. case "crocodile":
  17. case "tortoise":
  18. case "snake":
  19. System.out.println("reptile");
  20. break;
  21. default:
  22. System.out.println("unknown");
  23. break;
  24. }
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement