Advertisement
yovkovbpfps

ClassAnimal

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