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();
- if (animal.equals("dog")) {
- System.out.println("mammal");
- } else if (animal.equals("crocodile") || animal.equals("tortoise") || animal.equals("snake")) {
- System.out.println("reptile");
- } else {
- System.out.println("unknown");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment