Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class AnimalType {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String animal = scanner.nextLine();
- String type = " ";
- switch (animal) {
- case "dog":
- type = "mammal";
- break;
- case "crocodile":
- case "tortoise":
- case "snake":
- type = "reptile";
- break;
- default:
- type = "unknown";
- break;
- } System.out.println(type);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement