SHARE
TWEET

ClassAnimal

yovkovbpfps Mar 26th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top