a class castexception problem
Hi, i d like to do the following cast, but i got classcastexception.
String[] toks ={"a","b"{};
String[] pos =(String[]) tagger.tag(Arrays.asList(toks)).toArray();
// tagger.tag returns Object[]
Complier doesnt complain anything. How should I do this casting correctly please?
Thanks!
[481 byte] By [
zqzuka] at [2007-11-26 21:26:34]

if tagger.tag returns Object[] you can't expect the return value to be casted correctly to String[] , can you ?
By the way: Are you sure the following line in your source compiles correctly
String[] toks = {"a","b"{};
> Hi, i d like to do the following cast, but i got
> classcastexception.
>
> > String[] toks = {"a","b"{};
> String[] pos =(String[])
> tagger.tag(Arrays.asList(toks)).toArray();
>
> // tagger.tag returns Object[]
>
>
>
> Complier doesnt complain anything. How should I do
> this casting correctly please?
>
> Thanks!
String[] pos =(String[]) tagger.tag(Arrays.asList(toks)).toArray(new String[0]);