• Post Reply Bookmark Topic Watch Topic
  • New Topic

give me some idea

 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, everybody:
I am busying doing the FBN assignment. And in coding criterialFind() method, I have a ArrayList instance, list, to store the DataInfo object, which satisfy the criteria requirement. u know, the return value should be DataInfo[], so i try to use :return (DataInfo[])list.toArray() to return the value. But "castException" is produced. something wrong when i use the toArray() method?
Thank in advance!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Xiaoma,
The first time I used ArrayList the same thing happend to me. you have to do something like this:

Hope this helps
Michael Morris
SCJP2
 
xiaoma wang
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks you very much, Michael!
xiaoma wang
 
it's a teeny, tiny, wafer thin ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!