Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class Animals {
  5.  
  6. public static void main(String[] args) {
  7. Scanner user = new Scanner(System.in);
  8. System.out.println(" Here are some animal types! ");
  9.  
  10. ArrayList<String> animalTypes = new ArrayList<String>();
  11. animalTypes.add("Vertebrae");
  12. animalTypes.add("Reptile");
  13. animalTypes.add("Insect");
  14. animalTypes.add("Amphibian");
  15. System.out.println(" Enter new animal type");
  16. System.out.println(" Here is your animal types list! ");
  17.  
  18. // This for loop is inadequate, I need a while loop as I don't know the exact number of entries from the user//
  19. for (int index = 0; index < animalTypes.size(); index++) {
  20. System.out.println(animalTypes.get(index));
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement