PDA

Click to See Complete Forum and Search --> : Printing out in main


Milad87
Aug 13th, 2009, 09:49 AM
I have this code to print all elements out in an array

public void printChildren(ArrayList<Person> child){

for (int i = 0 ; i < child.size(); i++)
System.out.println( child.get(i).getName() + " " + child.get(i).getAge());



}
}

But I cant really make it work in the main.... trying to call it but I only get error.. so how can I call it or print it from the main

thanks

ComputerJy
Aug 14th, 2009, 04:01 PM
What error are you getting?

oceanebelle
Aug 19th, 2009, 04:23 PM
if you add static keyword to your function declaration of printChildren, then you'll be able to call this function from main.

hope this helps. :)