Question: Which statement is true about the following program? Select the one correct answer. (a) The program will not compile. (b) The program will compile, but
Which statement is true about the following program?

Select the one correct answer.
(a) The program will not compile.
(b) The program will compile, but will throw an exception when run.
(c) The program will compile and print the following when run:
[0, 1, -2, 3, -4, 5, -6, 7, -8, 9]
(d) The program will compile and print the following when run:
[0, -1, 2, -3, 4, -5, 6, -7, 8, -9]
(e) The program will compile and print the following when run:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
import java.util.Arrays; import java.util.function. Int Predicate; public class RQ12A96 { public static void main (String [] args) { int [] intArray = {0, -1, -2, -3, -4, -5, -6, -7, -8, -9); filter Int (intArray, val -> val < 0 && val 2 == 0); System.out.println (Arrays.toString (intArray)); } } public static void filterInt (int[] intArr, IntPredicate for (int i = 0; i < intArr.length; ++i) { if (predicate.test(intArr[i])) { intArr [i] = Math.abs (intArr[i]); } } predicate) {
Step by Step Solution
There are 3 Steps involved in it
d The lambda expression filters all integer values t... View full answer
Get step-by-step solutions from verified subject matter experts
