Question: This Java 8 challenge tests your knowledge of Lambda expressions! Write the following methods that return a lambda expression performing a specified action: 1.

This Java 8 challenge tests your knowledge of Lambda expressions! Write the following methods that return a

This Java 8 challenge tests your knowledge of Lambda expressions! Write the following methods that return a lambda expression performing a specified action: 1. PerformOperation isOdd(): The lambda expression must return true if a number is odd or false if it is even. 2. PerformOperation isPrime(): The lambda expression must return true if a number is prime or false if it is composite. 3. PerformOperation isPalindrome(): The lambda expression must return true if a number is a palindrome or false if it is not. Input Format Input is handled for you by the locked stub code in your editor. Output Format The locked stub code in your editor will print T lines of output. Sample Input The first line contains an integer, T (the number of test cases). The T subsequent lines each describe a test case in the form of 2 space-separated integers: The first integer specifies the condition to check for (1 for Odd/Even, 2 for Prime, or 3 for Palindrome). The second integer denotes the number to be checked. 5 14 25 3 898 13 2 12 Sample Output EVEN PRIME PALINDROME ODD COMPOSITE 10 import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { } Change Theme Language Java 7 public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Java code import javaio import javautil interface PerformOperation boolean c... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!