File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes give me some idea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "give me some idea" Watch "give me some idea" New topic

give me some idea

xiaoma wang
Ranch Hand

Joined: Mar 04, 2002
Posts: 74
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

Joined: Jan 30, 2002
Posts: 3451
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

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
xiaoma wang
Ranch Hand

Joined: Mar 04, 2002
Posts: 74
Thanks you very much, Michael!
xiaoma wang
Don't get me started about those stupid light bulbs.
subject: give me some idea
Similar Threads
criteriaFind Attack Plan, Comments Welcomed
ticket booking problem
return DataInfo[]
cast from Object[] to DataInfo[]
Pls Help ( javadoc comment for DataAccessFactory)