How to convert arraylist to array of strings

Pls let me know the convertion of arraylist to array of strings

I found this, toArray().
A sample.
Dimis

	
public static String[] getNames() throws Exception
{

      ArrayList al = new ArrayList();
      al.add("ram");
      al.add("raj");

      String str [] = (String []) al.toArray (new String [al.size ()]);
      return str;
}

The comments above assume that you are defining an ArrayList of Strings, or, at least, the objects you are storing in the ArrayList are Strings.