X1619: Are all elements negative?

Write the method boolean areAllNegative(int[] nums) in Java that returns true if all elements in the array nums are negative (less than 0), and returns false otherwise.

Examples:

areAllNegative({10,4,11,50}) -> false
areAllNegative({-10,-4,-11,-50}) -> true

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.