Array index out of bounds
Hi Guys i keep getting this error "java.lang.ArrayIndexOutOfBoundsException: 9" I have been stuck with it for a while and cannont copntinue find out how to sort it. please can you guys have a look and see if you can help
Code Java:
while(true)
{
c=0;
s1=""; // colum
System.out.println("--------------------------------------------- ---------------------------");
System.out.print("Enter columns Sequence between 1 to "+numberofcols+" : ");
st="192837465";
char st1[]= {1,9,2,8,3,7,4,6,5};
d=st+d;
System.out.println();
System.out.println("Ecfsdfsdfsdfsdt : ");
for(int i=0;i<numberofcols;i++)
{
c=(int)st1[i]-1;
System.out.println("(int)st.charAt(i) ="+(int)st.charAt(i));
System.out.println("c="+c);
for(int j=0;j<numberofrows;j++)
{
if(a[j][c]!='$')
System.out.println("fail here"); // ithink the problem is around these lines
s1=s1+a[j][c];
}
}
s1.trim();
c=0;
for(int i=0;i<numberofrows;i++)
for(int j=0;j<numberofcols;j++)
if(c<s1.length())
a[i][j]=s1.charAt(c++);
else
a[i][j]='$';
System.out.println();
System.out.println();
System.out.println("********************************************* *******************");
System.out.println();
THANK YOU
Re: Array index out of bounds
Can you please post all of your code so I have something to compile...
Thanks.