Page 1 of 1

The following class outputs false when it is executed. The array provided in the main method has a-1 in it and should re

Posted: Sat May 14, 2022 4:35 pm
by answerhappygod
The Following Class Outputs False When It Is Executed The Array Provided In The Main Method Has A 1 In It And Should Re 1
The Following Class Outputs False When It Is Executed The Array Provided In The Main Method Has A 1 In It And Should Re 1 (37.82 KiB) Viewed 56 times
The following class outputs false when it is executed. The array provided in the main method has a-1 in it and should return true. There is one statement in this class that needs to be modified in order to output true (the correct output) Identify the line and provide only the corrected line. Please do not rewrite the whole class . This class makes sure that a given array of integers does not have or -1 author xyz • version May 9, 2022 public class ZeroAndNegative ne { 7 sain method public static void main(String[] args) { intl array_nums = { 50, 11, 12, 54, -1); System.out.println("Result: " + test(array_nums)); Hethod to check for zeros and negative one • paras numbers is the input array itu boolean public static boolean test(int numbers) for (int i = 0; i < numbers. Length: 144) if (numbers == 0 && numbers == -1) { return true; } } return false; Format Table