Java interoperability

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);
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.152.58