Question
Write a static method public static char[] filter(char[] list, char target) The method will take an array of chars as input and another char. It
Write a static method public static char[] filter(char[] list, char target) The method will take an array of chars as input and another char. It will then create a new array that has all the chars from the input array (in the same order) except that all instances of target are removed. For example, char[] in = {'a', 'b', 'a' 'c', 'd'}; char[] out = filter(in, 'a'); // assert : out == {'b', 'c', 'd'} out = filter(in, 'b'); // assert : out == {'a', 'a', 'c', 'd'} Note: the length of the output array should only be as big as needed. You can create Java class called Part4 that has this method in it. Your class should have a main() method to test your method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started