delete item from array in java
- by davit-datuashvili
hello can anybody tell me what is wrong here? i want delete item from array but it shows me
error ArrayIndexOutBound exception
public class delete{
public static void main(String[]args){
int i;
//delete item from array
int k[]=new int[]{77,99,44,11,00,55,66,33,10};
//delete 55
int searchkey=55;
int nums=k.length;
for ( i=0;i<nums;i++)
if (k[i]==searchkey)
break;
for (int t=i;t<nums;t++)
k[t]=k[t+1];
nums--;
for (int m=0;m<nums;m++){
System.out.println(k[m]);
}
}
}