Method contains takes an array of integers and returns true if there exists any item in the array that satisfies a specified condition. For instance, in the following code fragment:
The intended result is that result1 is true because 37 is a prime number, result2 is true because both 100 and 49 are perfect squares, and result3 is false because there are no negative numbers in the array.
Implement the following components:
a. An interface that will be used to specify the second parameter to contains.
b. The contains method (which is a static method).
c. The classes Negative, Prime, and PerfectSquare.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here