I apparently can't figure out what I am doing wrong....I have been reading all day and googling help but it hasn't helped. Here's what I have...

    public static void main(String[] args) {
        ArrayList<Animal> animalCensus = new ArrayList<Animal>();
        Scanner input = new Scanner(System.in);

        //int uniqAnimal = 0;
        //String animalName;
        String endList;



            for ( int x = 0; x < animalCensus.size(); x++)
            {
                System.out.println("What animal did you see? When done, please type quit.");
                String animalName = input.toString();

                animalCensus.add(new Animal());

                endList = input.next();
                if (endList.equalsIgnoreCase("quit"))
                {
                    System.out.println(animalCensus);
                }


            }

what I am doing wrong

Please explain what happens. If you get errors, copy and paste them here.
If the code executes without errors, what does it do? What do you want the program to do?

Line 14, you are assigning toString() value to the variable animalName instead of taking an input from a user. Change it to input.nextLine() to get an input from a user after the user press Enter key.

Line 16, you are adding an empty Animal object (assuming that the Animal class has default constructor as public Animal() { ... }. You need to look at Animal class constructor for how to create a new object. I assume that it may take a name (String) when create an object, such as public Animal(String aName) { ... }. If so, you will need to create an object regarding the constructor (new Animal(animalName)).

Line 18, are you assuming that a user will enter a white space or enter after that? I would prefer input.nextLine() instead though...

Line 21, I assume that you have overrided toString() method of Animal class. If not, you will get a display that is not human-readable information of the object (i.e. [Animal@e53108,Animal@e53162]).

PS: Assume you have include the ArrayList package at the top of the file (before class ... {) as in import java.util.ArrayList;.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.