August 2018
Beginner
178 pages
4h 56m
English
Kotlin compiles extension functions as static functions that accept the type being extended as the first argument. This makes it possible to use them from Java. Our isPowerOf2 extension function is defined in a file named ExtensionFunctions, and calling the function from Java would look like this:
int n = 8;boolean isPowerOf2 = ExtensionFunctionsKt.isPowerOf2(n);
Read now
Unlock full access