Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

arrayindexout of bounds exeception

 
Shilpa Beri
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello friends

new to java world, just learning. help me with this problem i am struck up.


I am trying to write a program that multiplies two large integers.

here is my code but i am getting array index out of bounds.


just let me know how to resolve that arrayindex out of bounds problem

thanks

shilpa
 
Rajesh Chandra
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shilpa,
After completing the loop for(int j=3;j>0;j--), the value of som is 2 and again variable som is changed by the expression som=som-i which makes som 0.So far so good now with i=2 and j=2 the value of som comes to -1 which is awkward for an arrays index.So the runtime raises the exception array index out of bounds.You have to find a way so that som doesnt fall beyond 0.
cheers
Rajesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic