(int value)
| 59 | |
| 60 | //to check whether the element to be delted is present in the array is present or not |
| 61 | public boolean delete(int value) |
| 62 | { |
| 63 | int pos = -1; |
| 64 | for (int index = 0; index < lastIndex; index++) |
| 65 | { |
| 66 | if (arr[index] == value) |
| 67 | { |
| 68 | pos = index; |
| 69 | break; |
| 70 | } |
| 71 | } |
| 72 | if (pos == -1) |
| 73 | { |
| 74 | return false; |
| 75 | } |
| 76 | else |
| 77 | { |
| 78 | System.out.println(pos); |
| 79 | for (int i = pos ; i < size - 1; i++) |
| 80 | { |
| 81 | arr[i] = arr[i + 1]; |
| 82 | } |
| 83 | i--; |
| 84 | lastIndex = lastIndex - 1; |
| 85 | return true; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | //display function |
| 90 | void display() |