Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Removing an item from an array

807600Nov 17 2007 — edited Nov 18 2007
Hello sun forum,

I wonder if anyone would be kind enough to assist a newbie Java hobbyist with a few basic questions?

I don't want to take up too much of your time so I will be brief.

I want to prompt a user for ten numbers, then print the numbers in a column one on top of the next. Then I want to prompt the user for a number to be removed from the list. After the number is entered, it is removed, and the remaining arrays are printed in a row.

So far I have only written the code which prompts the user for the numbers, and the code which prompts the user for the number to be removed. I know how to print the array before the number is removed but I'm not sure how to print it in a column.
Next, I know how to search the array for the number but I'm not sure how to remove the number and then print the row of remaining numbers.

Here is a summary of the problem at hand:

method removeAll removes all instances of RemoveItem from the array
array of integers
length of array
integer to be removed
RemoveItem
method print
accepts two parameters
array
array length
prints array == to actual size of array
no blank spaces


program asks user for 10 integers
then asks for number to be deleted

array prints before number removed from list
array prints after number is removed

H.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2007
Added on Nov 17 2007
14 comments
596 views