Question: Method removeZeros: Write a method removeZeros that takes an array of integers as a parameter and returns a new array with the same contents except
Method removeZeros:
Write a method removeZeros that takes an array of integers as a parameter and returns a new
array with the same contents except the zeroes are gone.
Examples:
removeZeros new int returns
removeZeros new int returns
removeZerosnew int returns
Note : You can use the above examples in your main to check the methods works as intended.
Note : You can assume a legit input to the method, so no need to check for input correctness.
Tip : This method returns things, that means to check it you need to call it and store or print
result.
Tip : In java you must know the length of array you are declaring. Can you do it without
counting zeros first?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
