View Single Post
  #3 (permalink)  
Old 07-25-2007, 11:29 AM
mirage_87 mirage_87 is offline
Member
 
Join Date: Jul 2007
Posts: 8
mirage_87 is on a distinguished road
in an array the indexing begins from 0 and not from one..
so the flaw in yr program is that u started with one and went till 4
instead u shld have done
Quote:
for (int i = 0;i<=3;i++)
this is because no element numbers[4] exist as the index is only from 0 to 3.....that's why the error.

private static int[] numbers=new int[4]; means u r creatin an array with four elements with index 0,1,2,3 and not 4.............
i guess you got the point...........
Reply With Quote