File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes why can't my arraycopy work??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "why can Watch "why can New topic
Author

why can't my arraycopy work???

ming ming
Ranch Hand

Joined: May 17, 2006
Posts: 54

when i pass in more than 10 it will show me indexoutofbound...didn't i have the arraycopy method... :roll:
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Look at what the last parameter of arraycopy represents.
ming ming
Ranch Hand

Joined: May 17, 2006
Posts: 54
what shall i put then??
Pinkal Patel
Ranch Hand

Joined: Jun 16, 2006
Posts: 57
fish.legth instade of newFise.legnth


Pinkal Patel<br />SCJP 1.5<br />Preparing for SCWCD
ming ming
Ranch Hand

Joined: May 17, 2006
Posts: 54
i dun get it..y must we put fish.length instead of newFish.length..can someone explain 2 me??
Pinkal Patel
Ranch Hand

Joined: Jun 16, 2006
Posts: 57
What is the length of newfish Array ?
and What is the length of fish Array ?

If your loop is moving as much time as length of newfish what happen....


it will try to acces fish[newFish.length-1 ] which will throws Exception
wise owen
Ranch Hand

Joined: Feb 02, 2006
Posts: 2023
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8815
    
    5
For those of you keeping score, you won't have to worry about the System.arraycopy method, it's not on the exam - yea!


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
GeeCON Prague 2014
 
subject: why can't my arraycopy work???