-
Printing out in main
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
-
Re: Printing out in main
What error are you getting?
-
Re: Printing out in main
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. :)