public static int] filterodd(int] list) This method will take an array of ints as input. It will then create a new array

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

public static int] filterodd(int] list) This method will take an array of ints as input. It will then create a new array

Post by answerhappygod »

Public Static Int Filterodd Int List This Method Will Take An Array Of Ints As Input It Will Then Create A New Array 1
Public Static Int Filterodd Int List This Method Will Take An Array Of Ints As Input It Will Then Create A New Array 1 (39.45 KiB) Viewed 18 times
public static int] filterodd(int] list) This method will take an array of ints as input. It will then create a new array that has all the odd numbers removed. The order of the remaining numbers should not change. For example: int [] in ={1,2,7,2,5,6,3}; int [] out = filterodd(in); System. out. println(Arrays.toString(out)) will output [2,2,6]. Remember that an array is an object. Trying to print it directly will output its memory address. Instead, we can make use of the Arrays class and its static toString () method. Note: the length of the output array should only be as big as needed. In the main () method write three test cases to verify that your method is correct. (One is already done for you.) Along with the output you should use the array's length attribute to show that no extra space is used.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply