how can i deleting an element in an array, then replace it with to 0 the move 0 to the last element???

Recommended Answers

All 4 Replies

Why not use ArrayList or other similar Collection that can dynamically change size instead of defined size? Or why do you want to change value to zero and move it to end of array?

for deleting element of array you have to create it with collection like ArrayList.
In simple or normal array creation like
Int a[] = new int[5],
You can't delete element,you can just replace it with null string.the size of array remain as it is..

So use data structure as your need...

You can't "replace it with null string" in an int array.
For int arrays all you can do is to chose some value to represent elements that do not have a user value in them. Integer.MIN_VALUE could be a good choice.

Yes.As James Said you can't replace null string.

But you can choose some value that is never used in your code like MIN_VALUE of Integer class as james said.

Thanks james for correcting me.

Thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.