adspace
Answer Posted / Sanjeev Yadav
Yes, in Java 8 and later versions, you can use functional interfaces such as Runnable, Callable, or Supplier to define functions that return other functions. Here's an example using the Functional Interface Function<T,R> :n`nFunction<Integer, Function<Integer, Integer>> squares = n -> i -> n * i * i;nFunction<Integer, Integer> squareOfFive = squares.apply(5);nSystem.out.println(squareOfFive.apply(3)); // outputs 150n
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is parsing in java?
What is an object in java and how is it created?
Write a program to find the whether a number is an Armstrong number or not?
explain different ways of using thread? : Java thread
What is the difference between equals() and == in java?
What are the differences between heap and stack memory in java?
Realized?
Write a program to print count of empty strings in java 8?
Explain public static void main(string args[]) in java.
What is java string pool?
What is a constructor overloading in java?
What is the difference between break and continue statements?
Is minecraft 1.15 out?
Differentiate between static and non-static methods in java.
How to sort array in descending order in java?