Hi very one could someone help me with "delete method for Array"
I wrote this method in class Array but I didn’t know how could I decrement the size of array and I couldn’t make it work
this is the method
public void delete(int c)
{
for (int i=0;i<a.length;i++){
if(a[i]==c)
a[i]=a[i+1];
else
System.out.println(" not found");
}
and this it the calling in the main
System.out.println("enter the element that u want to delete it ");
int y=cin.nextInt();
a.delete(y);