for some reason my code is not going into the for loop. i completely skips it. any ideas??

private ArrayList<Investment> investments = new ArrayList<Investment>();

public String toString()
    {
        String outPut;
        outPut = "Account" + " " + super.getId() + "\n";
        for(int i=0; i < investments.size(); i++)
        {
            //outPut += investments.get(i).toString() + "\n";
            outPut += "Testing \n";
        }
        return outPut;
    }

Try printing out investments.size() before the for loop. I have the feeling that it's returning 0 (i.e. it's empty).

It will skip it if investments.size() is zero

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.