Can a function return a function?
Answer / 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 |
How do you check if two strings are equal in java?
why should we get the following error ? Exception in main method NoClassDefFoundError:classname could anyone give the detail clarification on how java compiler can look for .class file?
hoe can u call a constructor of a private classs to other inherited claa??
Different types of Layouts?
Can we use switch statement with strings?
What is left shift and right shift?
How arrays are stored in memory in java?
Write a program to find maximum and minimum number in array?
What is garbage collector?
what is ABSTRACTION and what are using in real time project?
int a=10,b=20,c=30 a= b+c;b=a+c;c=a+b; System.out.println("The value is"+a+b+c;
Explain the init method?