Question: What is wrong with my code: / / This method removes the number and then shifts all the integers one position to the left and

What is wrong with my code: // This method removes the number and then shifts all the integers one position to the left and returns true. Otherwise, it returns false.
public boolean remove(int numberToRemove){
int indx = search(numberToRemove);
if (indx ==-1)
return false;
else {
for (int i = indx; i < count -1; i++){
numArray[i]= numArray[i +1];
}
count--;
}
return true;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!