File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why can't my arraycopy work???

 
ming ming
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

when i pass in more than 10 it will show me indexoutofbound...didn't i have the arraycopy method... :roll:
 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at what the last parameter of arraycopy represents.
 
ming ming
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what shall i put then??
 
Pinkal Patel
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fish.legth instade of newFise.legnth
 
ming ming
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dun get it..y must we put fish.length instead of newFish.length..can someone explain 2 me??
 
Pinkal Patel
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2023
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those of you keeping score, you won't have to worry about the System.arraycopy method, it's not on the exam - yea!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic