Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why can't my arraycopy work???

 
ming ming
Ranch Hand
Posts: 54
  • 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: 2409
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what shall i put then??
 
Pinkal Patel
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fish.legth instade of newFise.legnth
 
ming ming
Ranch Hand
Posts: 54
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Bert Bates
author
Sheriff
Posts: 8898
5
  • 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