toArray does work. There's something wrong with how you are trying to use it. Post your code.
JamesCherrill
Posting Genius
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
posting a snippet might solve the problem in your case.
Regards,
Lucky
mytime19
Junior Poster in Training
50 posts since Dec 2006
Reputation Points: 10
Solved Threads: 3
To elaborate on what llemes said (and he is correct), you are trying to use the following method "public Object[] toArray(Object[] a)" which takes an array of Objects, but you are passing in an array of chars. "char" is a primitive type, not an Object, which is why you are getting the error. On the other hand, the Character class (like every other class), "is-an" Object, so you can use that. Or you could simply use:
Character[] theChars = letters.toArray();
BestJewSinceJC
Posting Maven
2,772 posts since Sep 2008
Reputation Points: 874
Solved Threads: 354