On Jan 11, 5:10 pm, Rene Olgers <ollie1...@gmail.com> wrote:
> Hi all,
>
> trying to split an array (String) I get an error.
>
>         String[] firstname = names.split(" ");
> Do I have to import something?
No, split is a method of String which is inside java.lang package
which is imported by default, but if names is an array you have to get
at the desired element of the array before applying split to it,
something along:
names[i].split(" ");

Michèle Garoche

-- 
To post to this group, send email to javaprogrammingwithpassion@googlegroups.com
To unsubscribe from this group, send email to 
javaprogrammingwithpassion+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en

Reply via email to