string arrays and copying
Code:
String[] getNames()
{
// Creates a string array containing the full name of each staff member
String[] getNames = new String[10];
for(int i = 0; i < 3; i++)
{
getNames.add(list.get(i).getFullName());
}
getfullname is a method that contains all the names....my problem is is it wont allow me to add the getfullname into the string array getanames or is there an easier way to copy
Re: string arrays and copying
You're trying to add something to an array as if it were an ArrayList. It's not, and arrays do not have an .add(...) method. You instead simply assign the String of interest to the [ith] item in the array using array [...] notation.
Another big problem I see is your use of the magic numbers 10 and 3 in that code.