return a value from a thread c++ code example
Example 1: java function without return
//The Function type is declared as
interface Function<T,R> {
R apply(T t);
}
//And the Consumer type is declared as
interface Consumer<T> {
void accept(T t);
}
//Consumer is compatible with methods that receive
//a T and return nothing (void).
Example 2: return type in kotlin function
//Function having two Int parameters with Int return type
fun sum(a: Int, b: Int): Int {
return a + b
}