Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions

Question

How to solve maths problems with examples

Answered: 1 week ago